check process Process1-M-aaa matching "/home/user/binn/GK/Process1 -f/home/user/binn/GK/Process1.aaa.properties --dispatch=M --daeMn"
start program "/home/user/binn/GK/Process1 -f/home/user/binn/GK/Process1.aaa.properties --dispatch=M --pidfile /tmp/Process1-M.aaa.pid" as uid user and gid user
stop program "/bin/bash -c '/bin/kill -9 `/bin/cat /tmp/Process1-M.aaa.pid`'" as uid user and gid user
if does not exist then exec "/bin/bash -c '/etc/monit.d/scripts/nagios_cmd.sh proc_m_aaa_crit'" as uid user and gid user
else if succeeded then exec "/bin/bash -c '/etc/monit.d/scripts/nagios_cmd.sh proc_m_aaa_ok'"
if uptime > 15 seconds then exec "/bin/bash -c '/etc/monit.d/scripts/nagios_cmd.sh proc_m_aaa_ok'"
group gateway
My ideia is:
If the process goes down, monit will execute nagios_cmd.sh script, it will trigger a critical Alarm on nagios and will also start de process, I couldnt get monit starting the process and executing the script, so I had to insert both actions together in the script.
If the process is running, it will trigger an OK signal do Nagios.
To keep the OK Signal do nagios, I did the uptime thing, because I need to keep sending OK to Nagios.
Here is the status:
Process 'Process1-M-aaa'
status Uptime failed
monitoring status Monitored
pid 10601
parent pid 1
uid 1000
effective uid 1000
gid 1000
uptime 14h 51m
children 0
memory kilobytes 20064
memory kilobytes total 20064
memory percent 0.2%
memory percent total 0.2%
cpu percent 0.1%
cpu percent total 0.1%
data collected Tue, 03 Jun 2014 11:43:02
The service is up, fit the uptime condition ( > 15 seconds), but I get this status "uptime failed".