I need to be informed by nagios when a process on a remote server is restarted.
The only thing I do not know how to do is to check its process state, and what way to do it?
I got in remote server this nrpe command for now: ./check_procs -c 1: -a "/usr/local/yyyprogram/sbin/XXXdaemon" -s Sl
but this process must work all the time, has own mechanism to restart, and this is the only thing I need to know - when exactly it restarts. What state of process should I add here, and what way - example -s SlRD is ok? or -s Sl -s R -s D is ok? Maybe I can do it other way to have this kind of information: OK|WARNING|UNKNOWN|CRITICAL
? The only status OK for me is OK (means working).
Also, how to monitor it from other nagios server, should I check this every one second? When service restarts, I can be notified one or two minutes later, but how to know it happened without checking logs? PID of this service after restart mechanism is different from before.
How can I be sure that all status is included in line of nrpe command config?
Please help:)
EDIT
root@server:/usr/local/nagios/libexec# ./check_procs -vv -a "/usr/local/yyyprogram/sbin/xxxdaemon"
CMD: /usr/bin/ps axwwo 'stat uid pid ppid vsz rss pcpu cgroup:256 comm args'
Matched: uid=0 vsz=9412 rss=2804 pid=517515 ppid=1 jid=0 pcpu=0.20 stat=Sl etime= prog=xxxdaemon args=/usr/local/yyyprogram/sbin/xxxdaemon -d /usr/local/yyyprogram/conf -b
cgroup_hierarchy=(null)