monit-general
[Top][All Lists]
Advanced

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

Re: Restarting after x cycles of downtime


From: Martin Pala
Subject: Re: Restarting after x cycles of downtime
Date: Thu, 5 Mar 2015 22:30:33 +0100

Hi,

first - when the process is monitored by Monit, you should either restart it 
gracefully via Monit or at least disable the monitoring before manual actions:

Either:

        monit restart jetty8  # restart via Monit

Or:

        monit unmonitor jetty8   # disable monitoring
        /etc/init.d/jetty8 restart   # e.g. restart/deploy the service manually
        monit monitor jetty8       # enable monitoring


You can also suppress the restart on first failure like this (not recommended 
as workaround for manual actions - above solution is better):

--8<--
check process jetty8 with pidfile /var/run/jetty8.pid for 2 cycles
   start program = "/etc/init.d/jetty8 start"
   stop program = "/etc/init.d/jetty8 stop"
   if does not exist for 2 cycles then restart
--8<--


Regards,
Martin


> On 05 Mar 2015, at 03:36, Rahul Amaram <address@hidden> wrote:
> 
> Hi,
> I am facing a particular issue. I have defined a monit configuration for 
> jetty8 as below:
> 
> check process jetty8 with pidfile /var/run/jetty8.pid
>  start program = "/etc/init.d/jetty8 start"
>  stop program = "/etc/init.d/jetty8 stop"
> 
> Now, the problem is at times, when I restart jetty8 manually, and within that 
> short duration, if monit check runs, it assumes that jetty8 is not running, 
> tries to restart it and sends an alert.
> 
> I would like to use something like "for X cycles" feature. Where in monit 
> does not attempt restart of jetty8 (or send alert) unless it finds jetty8 
> down for X consecutive cycles. I have tried the following syntax but it is 
> invalid.
> 
> check process jetty8 with pidfile /var/run/jetty8.pid for 2 cycles
>  start program = "/etc/init.d/jetty8 start"
>  stop program = "/etc/init.d/jetty8 stop"
> 
> 
> Suggestions on how this can be achieved would be highly appreciated.
> 
> Thanks,
> Rahul.
> 
> -- 
> <http://www.festivalofmedia.com/asia-pacific/awards>
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general




reply via email to

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