3

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

Mike
  • 22,310
  • 7
  • 56
  • 79

1 Answers1

2

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.

panaroik
  • 832
  • 5
  • 12
  • 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 03 '13 at 04: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 (http://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 03 '13 at 17:47
  • Thanks for your help. Thanks Mike for formatting my question. – user2030417 Feb 03 '13 at 18:12
  • Is there anything else you would like to know, or it is solved? – panaroik Feb 03 '13 at 18:15