monit-general
[Top][All Lists]
Advanced

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

Re: Question about restart/stop


From: Martin Pala
Subject: Re: Question about restart/stop
Date: Tue, 5 Nov 2013 15:59:03 +0100

On 05 Nov 2013, at 15:29, V.Krishn <address@hidden> wrote:

> On Tuesday, November 05, 2013 04:09:12 PM you wrote:
>> If there will be standalone restart program, it'll also have some timeout
>> => there is no difference between start/stop/restart in that point.
>> 
>> If the stop/start timed out, the error event is send and Monit can retry
>> next cycle.
> 
> Does that mean if in 30s "stop" does not succeed monit sends alert to global 
> email ?
> 
> So to avoid 'false positive alerts' one needs to set cycle explicitly ?
> eg.
> apache settings become:
> 
> check process apache with pidfile /var/run/httpd.pid
>       start program = "/etc/init.d/httpd start"
>       stop program  = "/etc/init.d/httpd stop"
>       if failed port 80 then restart
>       if failed port 443 with timeout 15 seconds then restart
>       if failed port 80 for 3 times within 5 cycles then alert
>       if failed port 443 for 3 times within 5 cycles then alert
> 
> above would be ok, or do I need do if... then... else ?
> 
> -- 
> Regards.
> V.Krishn


Yes, as mentioned: if stop or start will fail, event is created (error logged 
and alert sent).

The cycle length ("set daemon XYZ") and start/stop timeout are not related. 
Likewise the "port" test timeout is not related to start nor stop timeout. If 
the test failed, alert is send even if the action is only "restart". Your 
configuration can be simplified to this:

check process apache with pidfile /var/run/httpd.pid
      start program = "/etc/init.d/httpd start"
      stop program  = "/etc/init.d/httpd stop"
      if failed port 80 then restart
      if failed port 443 with timeout 15 seconds then restart

If the stop or start of your apache will be slow, THEN you may increase the 
timeout of the given operation, for example:

check process apache with pidfile /var/run/httpd.pid
      start program = "/etc/init.d/httpd start"
      stop program  = "/etc/init.d/httpd stop" with timeout 60 seconds


Regards,
Martin





reply via email to

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