Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_procs2

Rating
1 vote
Favoured:
0
Hits
153752
Files:
FileDescription
check_procs2Plug-in written in Perl
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Check the existence of processes on host
While check_procs from the Nagiog Plugin collection is a very powerful tool I missed the ability to check for the existence of multiple processes. check_procs can only check for one process name. check_procs2 can look for a number of process names and returns a warning or a critical if the number of each of the process names match a certain level.



check_procs2 expects the following parameters:



check_procs2 [and] ...



The 'and' is optional and its only purpose is to make the command line more legible; an 'or' operator is planned for the future.



Valid operators are ge (greater or equal), gt (greater than), le (less or equal), lt (less than), and eq (equal).



Example:



* check_procs2 sendmail ge 2 and xntpd eq 1 and svc ge 2



Checks if at least two processes called 'sendmail', exactly one process called 'xntpd' and at least two processes tha contain 'svc' exist on the host. The process names are regular expressions.



The return string looks like this if everything is okay:



# check_procs2 sendmail ge 2

PROCS OK: 60 processes - no problems found



If something is wrong it will return:



# check_procs2 sendmail ge 3

PROCS CRITICAL: 60 processes - sendmail 2/3



The 2/3 means 2 processes are running and 3 is the threshold (in this case it means that at least 3 sendmails were expected).



Some of the code (especially the call to ps) is written for Solaris. It was tested on Solaris 10 with Perl 5.8.4. The entire plug-in is very much alpha quality but should work more or less.



The next revision of this plug-in will have some way to specify thresholds for warning and critical levels. I would also like to implement an 'or' operator.
Reviews (1)
I tired this it works in simple and straight forward cases but fails in bit odd situations.
For example
$ ./check_procs2 gurjobs eq 1 and daemon Prod eq 1
./check_procs2: incomplete expression

In my case "daemon PROD" is one process; if I put just a 'daemon' or just 'PROD' its not going to work because there are lots of other daemons on host and processes also that have PROD in them but I need to watch these 2 specific processed only.
It will also be nice if user option can be added so that if there processes that share a name but run by different users; then you can extract them out.