Giter Club home page Giter Club logo

checkglances's Introduction

========================================================= A Nagios|Shinken plugin to grab stats on a Glances server

screenshot

What is it ?

CheckGlances is a Nagios plugin. It can grab stat on a Glances server using a XML RCP over HTTP link.

Glances server can be ran on GNU/Linux, BSD, Mac OS and Windows operating system.

  1. Start Glances server on yours hosts

  2. Configure our Nagios|Shinken server with the CheckGlances plugin

  3. Enjoy...

Be aware...

Use checkglances v0.4 for Glances 1.x server Or checkglances v0.5 or higher for Glances 2.x (or higher)

CLI Examples

CPU

$ ./checkglances.py -H localhost -s cpu
CPU consumption: 2.96% | 'percent'=2.96 'kernel'=0.73 'iowait'=0.20 'idle'=97.04 'user'=1.89 'irq'=0.00 'nice'=0.00

LOAD

$ ./checkglances.py -H localhost -s load
LOAD last 5 minutes: 0.22% | 'min1'=0.13 'min5'=0.22 'min15'=0.29

MEM

$ ./checkglances.py -H localhost -s mem
MEM consumption: 59.50% | 'used'=3411509248.00 'cache'=1071792128.00 'total'=3934547968.00 'percent'=59.50 'free'=523038720.00

SWAP

$ ./checkglances.py -H localhost -s swap
SWAP consumption: 3.70% | 'used'=150159360.00 'total'=4080005120.00 'percent'=3.70 'free'=3929845760.00

PROCESS

$ ./checkglances.py -H localhost -s process
Running processes: 1 | 'running'=1 'total'=143 'sleeping'=142

NETWORK

$ ./checkglances.py -H localhost -s net -e eth0
Network rate: 5479658 | 'interface_name'=eth0 'rx'=327514 'tx'=5479658

FILE SYSTEM

$ ./checkglances.py -H localhost -s fs -e /
FS using space: 8% | 'mnt_point'=/ 'used'=22371450880 'device_name'=/dev/sda2 'avail'=910404046848 'fs_type'=ext4 'size'=982693486592

Also implemented: getDiskIO, uptime, system

How to configure Nagios ?

First of all, copy the checkglances.py file to your Nagios plugin folder.

Then enter the new section on your commands.cfg file:

define command{
    command_name checkglances
    command_line $USER1$/checkglances.py -H $HOSTADDRESS$ -s $ARG1$ -w $ARG2$ -c $ARG3$
}

define command{
    command_name checkglanceswithparam
    command_line $USER1$/checkglances.py -H $HOSTADDRESS$ -s $ARG1$ -e $ARG2$-w $ARG3$ -c $ARG4$
}

Configure a new service for your host (where Glances server is up and running):

define service {
    use generic-service
    host_name myhost
    service_description CPU
    check_command checkglances!cpu!70!90
}

define service {
    use generic-service
    host_name myhost
    service_description LOAD
    check_command checkglances!load!1!5
}

define service {
    use generic-service
    host_name myhost
    service_description MEM
    check_command checkglances!mem!70!90
}

define service {
    use generic-service
    host_name myhost
    service_description SWAP
    check_command checkglances!swap!70!90
}

define service {
    use generic-service
    host_name myhost
    service_description PROCESS
    check_command checkglances!process!30!100
}

define service {
    use generic-service
    host_name myhost
    service_description NETWORK eth0
    check_command checkglanceswithparam!net!eth0!7500000!10000000
}

define service {
    use generic-service
    host_name myhost
    service_description FILESYSTEM /
    check_command checkglanceswithparam!fs!/!70!90
}

Coming soon...

Disk IO

checkglances's People

Contributors

d33d33 avatar gourneau avatar jmbarbier avatar mohierf avatar nicolargo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

checkglances's Issues

getCore

Bonjour et, merci pour ce script,

La fonction getCore renvoie un string et non un nombre.
Cela semble poser des problèmes pour les seuils warning, dans la fonction "load".

No recent update, still compatible ?

Is this plugin still compatible with Glances 2.5 version ?

Since there as been no recent update, what is the status of this plugin ? Known bugs ? Required improvements ?

Stat 'load' fails when remote server is Windows

Remote server Linux:

$ ./checkglances.py -v -H 192.168.0.13 -s load
$ LOAD last 5 minutes: 0.08 | 'cpucore'=1.00 'min1'=0.07 'min5'=0.08;1;5 'min15'=0.10

Remote server Windows:

$ ./checkglances.py -v -H 192.168.0.11 -s load
Traceback (most recent call last):
  File "./checkglances.py", line 554, in <module>
    main()
  File "./checkglances.py", line 547, in main
    stat = stat, statparam = statparam)
  File "./checkglances.py", line 239, in check
    checked_value = load['min5']
KeyError: 'min5'

Note: I have a fix for this exception ...

Uptime check raises an exception

On my system Ubuntu, the check uptime returns a string as of: 1 day, 20:24:42.

Checkglances.py raises an exception:

[1448194850] INFO: [Alignak] Result long output: File "/usr/local/var/lib/alignak/libexec/checkglances.py", line 596, in <module>
main()
File "/usr/local/var/lib/alignak/libexec/checkglances.py", line 589, in main
stat = stat, statparam = statparam)
File "/usr/local/var/lib/alignak/libexec/checkglances.py", line 203, in check
uptime_s = time.strptime(uptime, "%H:%M:%S")
File "/usr/lib/python2.7/_strptime.py", line 467, in _strptime_time
return _strptime(data_string, format)[0]
File "/usr/lib/python2.7/_strptime.py", line 325, in _strptime
(data_string, format))
ValueError: time data u'1 day, 20:17:46' does not match format '%H:%M:%S'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.