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 17:08:14 -0700

On Thu, Jun 26, 2008 at 4:27 PM, Martin Pala <address@hidden> wrote:
>
>
> Art Age Software wrote:
>>
>> I would like to be able to execute an arbitrary action after a
>> specified number of restart attempts have failed. It appears that the
>> only thing allowed in the "if x restarts within y cycles" clause is
>> the timeout command. Is that true?
>
> Yes, that's true. We plan to add this feature, there is also patch from Alec
> which implements it. I'll look on it and will try to integrate with upcoming
> monit 5.0.

Thanks. Is there any work-around in the meantime? I was thinking of
creating a second "ghost" service that attempts to connect to mysql
each cycle and forces a failover if it cannot connect (but before the
other service times out). Something like:

---------------------
check process mysql1 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 host mysql2 with address localhost
  mode manual
  if failed port 3306 protocol mysql for 6 cycles then exec
"/usr/lib/heartbeat/hb_standby"
---------------------

What do you think? Or is there a better approach?




reply via email to

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