Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

5 Answers 5

up vote 12 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

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

share|improve this answer

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 but check_procs (that the others already mentioned) will do that.

share|improve this answer
    
That is interesting! I see the plugin requires a send/expect string. How do I find these for e.g. sendmail and openvpn? –  Sandra May 10 '12 at 12:24
2  
Does it require the send/expect string? You can find what to send for sendmail by either reviewing the SMTP spec or by connecting with telnet localhost 25 and trying it out yourself. OpenVPN might be a bit more tricky as it wants to be encrypted however sending some nonsense and receiving an error message might be adequate for your needs. –  Ladadadada May 10 '12 at 12:28
    
Ups. I tried the check_udp instead of check_tcp. Using telnet to get the send/expect will certainly become useful. –  Sandra May 10 '12 at 12:39

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.