I need to run a shell script if a service is ok with monit, to link to my other monitoring system (nagios).
Basically what I need to achieve is to make monit send an alert when a service was restarted and another alert when the service is ok.
I have tried the following without any luck:
if 1 restarts within 1 cycles then exec "<send WARNING alert here>"
if 0 restarts within 5 cycles then exec "<send OK alert here>"
The above complains about "Error: zero or negative values not allowed in a action rate statement ''OK''"
if 1 restarts within 1 cycles then exec "<send WARNING alert here>"
else if succeeded for 5 cycles then exec "<send OK alert here>"
The above complains about the "else"... I believe the "If X Restarts" doesn't support an "else"
Any suggestions to achieve this?