monit-general
[Top][All Lists]
Advanced

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

Re: [monit] How to Achieve "if x restarts within y cycles then exec ..."


From: Art Age Software
Subject: Re: [monit] How to Achieve "if x restarts within y cycles then exec ..."
Date: Thu, 26 Jun 2008 18:10:09 -0700

On Thu, Jun 26, 2008 at 6:03 PM, Martin Pala <address@hidden> wrote:
>
>
> Art Age Software wrote:
>>>
>>> Yes, this could work. Optionally it could be possible to use the pidfile
>>> using similar approach:
>>>
>>> --8<--
>>> check process mysql with pidfile /var/run/mysqld/mysqld.pid
>>>  mode manual
>>>  every 2 cycles
>>>  if failed unix "/var/lib/mysql/mysql.sock" then restart
>>>  if failed host localhost port 3306 protocol mysql then restart
>>>  if 5 restarts within 10 cycles then timeout
>>>
>>> check file mysql_pidfile with path /var/run/mysqld/mysqld.pid
>>>  mode manual
>>>  if changed timestamp for 5 cycles then exec
>>> "/usr/lib/heartbeat/hb_standby"
>>> --8<--
>>>
>>> On restart the script will change the timestamp of the pidfile => the
>>> second
>>> service check can trigger failover/standby based on it.
>>
>> I like your approach better because it seems more reliable. With my
>> approach, I think it is possible for the mysql protocol checks to
>> succeed if the timing is just right (i.e. the check happens between
>> restart and crash).
>>
>> With your approach, should the condition match exactly for both
>> checks? For example:
>>
>> if 5 restarts within 10 cycles then timeout
>> if changed timestamp 5 times in 10 cycles then exec "hb_standby"
>>
>> Will it then be guaranteed that if the restart/timeout condition
>> occurs, then the changed timestamp condition/action will also occur?
>> Or is there any potential for funny timing anomalies?
>
>
> I have not tested it, i recommend using -v monit option to tune the solution
> ;) If you'll need help, let me know.
>
> Thanks,
> Martin

Will do. Thanks.




reply via email to

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