Re: monit without start/stop

From:

Martin Pala

Subject:

Re: monit without start/stop

Date:

Thu, 19 Aug 2010 20:30:27 +0200

On Aug 19, 2010, at 8:19 PM, Kimo Rosenbaum wrote:
>> The alert settings is shared by all testing rules in given service. If you
>> want alert for one rule only, you can split the rules to two separate
>> checks
>> like this:
>
>
> Thanks but this doesn't address what I'm seeing. I'm not using the alert
> functionality.
>
> What I'm seeing is that every interval, if the service check fails and the
> previous state was fail, the exec script is ran and messages are logged.
> Whereas
> if the service check passes and the previous state was pass, then the exec
> script is not run and no messages are logged.
>
> Expected behavior:
>
> previous state -> current state | result
> fail -> fail | no exec, no message
> fail -> success | exec, message
> success -> success | no exec, no message
> success -> fail | exec, message
>
> But the observed behavior of the fail -> fail case is 'exec, message'.
> Shouldn't
> the behavior of fail -> fail and success -> success be the same?
No - by design Monit tries to recover the failure state, hence if the failure
remains, Monit tries to recover it again. There are options which allow to
limit the number of retries such as this:
if 3 restarts within 5 cycles then exec "/foo/bar"
if 8 restarts within 10 cycles then unmonitor
The Monit alerting is ready for the recovery retries and sends only one alert -
on state changes (success -> fail && fail->success). Note: there is also
optional reminder option for alert so you can receive repeated alert on custom
number of poll cycles (default is only one alert with no reminder).
If you don't use monit alert and instead handle the alerting in executed script
whereas only state change alert is necessary, you will need to modify the
script so, that it sends alert on state changes only.
Regards,
Martin