The point of no return

A New Supervisord Plugin for Nagios

23rd December 2014 by Ali Erdinç Köroğlu

In my last entry I mentioned about Supervisord and how beautiful it is. While I’m looking for how to integrate Supervisord to Nagios I couldn’t find what I’m looking for so I decided to write a new supervisord plugin for nagios. What I was looking for is a plugin works on Nagios server (so no need to install remote servers) to get information about processes from remote supervisords. So here it is.. check_supervisor

Usage: check_supervisord.py -H 192.168.1.1 -P 9001 -u superv -p superv -a glassfish
 
Options:
  -h, --help     
  -H HOSTNAME, --hostname=HOSTNAME (Supervisord hostname)
  -P PORT, --port=PORT (Supervisord port)
  -u USERNAME, --username=USERNAME (Supervisord username)
  -p PASSWORD, --password=PASSWORD (Supervisord password)
  -a PROCNAME, --process-name=PROCNAME (Process name defined in /etc/supervisor.d/*.ini or supervisorctl status)

Console Output:

[root@nagios ~]# /usr/lib64/nagios/plugins/check_supervisord.py -H 192.168.1.1 -P 9001 -u superv -p superv -a glassfish
glassfish OK: 12 day(s) 17 hour(s) 29 minute(s)

You should add the new command definition for check_supervisord into nagios’s commands.cfg

/etc/nagios/objects/commands.cfg
1
2
3
4
define command{
    command_name    check_supervisord
    command_line    $USER1$/check_supervisord.py -H $HOSTADDRESS$ -P $ARG1$ -u $ARG2$ -p $ARG3$ -a $ARG4$
}

And you can use in a definition like this :)

/etc/nagios/conf.d/services/glassfish.cfg
1
2
3
4
5
6
define service {
    use generic-service
    host_name   srv1
    service_description Glassfish
    check_command   check_supervisord!9001!superv!superv!glassfish
}


A screenshot from nagios web interface

Leave a Reply

Name

Mail (never published)

Website