Monitor worker process with nagios

monitoringnagiosnrpe

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

Best Answer

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.