Generic Nagios plugin to check if a specific process/service is running?

Solution 1:

I use the standard NAGIOS check_procs plugin, with the -C flag, shown here being invoked from nrpe.cfg via NRPE:

command[check_spamd]=/usr/lib/nagios/plugins/check_procs -c 1: -w 3: -C spamd

which will WARN if it doesn't find at least three processes with the executable name (not counting path) spamd, and which will CRIT if it doesn't find at least one.

Solution 2:

I am using this script to check various running processes. You can edit these two lines:

PROCLIST_RED="sshd"
PROCLIST_YELLOW="syslogd"

to change the red (critical) processes and yellow (warning) processes.

Also, this script checks for open ports (listening state). You can edit the line:

PORTLIST="22"

I even modified the script myself by defining a new variables UDP_PORTLIST to check for UDP sockets.


Solution 3:

The "check_procs" plugin is what you want, it is available on
http://nagiosplugins.org/man/check_procs