nice idea, but monit can not do this. Monit handle the current status
Based on the sample
check program hwtest with path /usr/local/bin/hwtest.sh
with timeout 500 seconds
if status = 1 then alert
if status = 3 for 5 cycles then exec "/usr/local/bin/emergency.sh"
The hwtest.sh called every given interval,
you get an alert if hwtest.sh status code changed to status code 1.
The emergency.sh script will called is the hwtest.sh script status code
is 3 for five interval cycles.
You can check the status code in the emergency.sh script with the
MONIT_PROGRAM_STATUS environment variable.
Unfortunately, you get no information about the previous status code.
The scripts are called only once, you get one alert if the status code
changed to 1, as long as the status code is 1 no new alert will send.
And the emergency.sh script will called after the status code is 3 for 5
times. As long as the status code is still 3 the script will not called
> I would like to know if it is possible to combine some status.
> Goal to alert when status !=0 and status changed
> We want to get notified when the status change from 0 to something else and
> each time it change value which is not 0.
> we want to be alert when status changed from 0 to X and later on when
> status change from X to Y until it changed back to clear situation (code 0).
> Is that possible ?
> We could write a long list of
> if status = X then
> if status = Y then
> if status = Z then
> if status = Q then
> fi status = P then
> if status = R then
> etc... but the list is around 30 status code.
> Best Regards,