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 am working on setting up Nagios monitoring. I was able to setup and monitor the system processes. Now, I am working on setting up monitoring for custom running processes.

We are having python worker process running with identifier. Each process is having it's separate pid file (worker_1.pid, worker_2.pid)

root      3642     1  3 Jan24 ?        08:22:36 /usr/bin/python /test/worker.py -i 1 
root      345     1  3 Jan24 ?        08:22:36 /usr/bin/python /test/worker.py -i 2

I am not sure which option I have to use of check_procs to monitor these processes separately?

root@instance:/etc/nagios# /usr/lib/nagios/plugins/check_procs -C python -a worker
PROCS OK: 2 processes with command name 'python', args 'worker'

Thanks

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

You can use option -a as you used in your example, but like this:

root@nagios:/etc/nagios3/conf.d# /usr/lib/nagios/plugins/check_procs -C mysqld -a "--basedir=/usr --datadir=/var/lib/mysql"
PROCS OK: 1 process with command name 'mysqld', args '--basedir=/usr --datadir=/var/lib/mysql'

So in your case it would be:

/usr/lib/nagios/plugins/check_procs -C python -a "/test/worker.py -i 1"

And then it should match only one process.

share|improve this answer
    
Thank you for your reply. It's working for me. Just curious, is this best possible solution to do string match. Is there any other way (using pid) for achieve this? –  user2030417 Feb 3 '13 at 4:31
    
Plugin check_procs (which is part of nagios-plugins package) has only option for checking arguments (option -a) or checking parent PID of the running process (option -p). But it has no option for checking PID of the process. You can go through this site of plugins (exchange.nagios.org/directory/Plugins) and maybe you will find some other plugin which will be able to check process by its PID. –  panaroik Feb 3 '13 at 17:47
    
Thanks for your help. Thanks Mike for formatting my question. –  user2030417 Feb 3 '13 at 18:12
    
Is there anything else you would like to know, or it is solved? –  panaroik Feb 3 '13 at 18:15
    
It's solved for now. Thanks. –  user2030417 Feb 4 '13 at 15:41
add comment

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.