I see on http://exchange.nagios.org that there are not plugins to check if sendmail, xinetd, automount, ypserv, ypbind, mailscanner, mcafee, clamav, samba server, and openvpn are running.
Of course all these should be stable programs, but they are critical, so I would like to check if they are running.
Question
Does there exist a generic plugin to check for specific processes?
I use the standard NAGIOS
check_procs
plugin, with the-C
flag, shown here being invoked fromnrpe.cfg
via NRPE: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.I am using this script to check various running processes. You can edit these two lines:
to change the red (critical) processes and yellow (warning) processes.
Also, this script checks for open ports (listening state). You can edit the line:
I even modified the script myself by defining a new variables
UDP_PORTLIST
to check for UDP sockets.The "check_procs" plugin is what you want, it is available on
http://nagiosplugins.org/man/check_procs
Any services that should be listening on a TCP port can be checked with
check_tcp
. By doing the connection check externally you check that the firewall is allowing connections through on that port in addition to checking that the process is running and listening on the correct port.The
check_tcp
check will not tell you if someone started up Postfix instead of sendmail or configured nginx to listen on port 80 instead of Apache butcheck_procs
(that the others already mentioned) will do that.Generally, it's better to actually connect to a network service and see if it's responding as expected, instead of just using check_tcp or checking if the service is running.
In the case of Samba, ClamAV, Sendmail, etc., there are service-specific plugins to check these (even if checked on "localhost" via NRPE) that will be more accurate than just checking if the port is open. Obviously, checking the tcp port and/or using check_procs is better than nothing.
Check below article. It perfectly explains how to monitor specific processes.
https://support.nagios.com/kb/article/process-checks-782.html