monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Monit check program status


From: Lutz Mader
Subject: Re: Monit check program status
Date: Fri, 13 Dec 2019 23:59:30 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

Hello Guillaume,
nice idea, but monit can not do this. Monit handle the current status
code only.

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
again.

With regards,
Lutz

p.s.
see for some more information at
https://mmonit.com/monit/documentation/monit.html#PROGRAM-STATUS-TEST
and
https://mmonit.com/monit/documentation/monit.html#ENVIRONMENT


Am 13.12.19 um 16:24 schrieb Guillaume Fran├žois:
> Hello,
> 
> 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,
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]