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 11:39:12 +0100

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

> On Tuesday, November 05, 2013 03:06:07 AM you wrote:
>> On 03 Nov 2013, at 07:25, V.Krishn <address@hidden> wrote:
>>> Was wondering why does monit not support ?
>>> eg.
>>> 
>>>   restart program  = "/etc/init.d/<service> restart"
>> 
>> There is "stop program" and "start program" ... if you know how to stop and
>> how to start, you know how to restart.
>> 
>> We may add standalone "restart" statement in the future, as some init
>> scripts have specific restart command, but in general it shouldn't be
>> necessary, as (stop -> start) == (restart)
>> 
>> Regards,
>> Martin
> 
> <quote from wiki>
> ...
> Here's a more advanced example for monitoring an apache web-server listening 
> on the default port number for HTTP and HTTPS. In this example Monit will 
> restart apache if it's not accepting connections at the port numbers. The 
> method Monit use for a process restart is to first execute the stop-program, 
> wait up to 30s for the process to stop and then execute the start-program and 
> wait up to 30s for it to start. The length of start or stop timeout can be 
> overridden using the 'timeout' option. If Monit was unable to stop or start 
> the service a failed alert message will be sent if you have requested alert 
> messages to be sent.
> 
> check process apache with pidfile /var/run/httpd.pid
>       start program = "/etc/init.d/httpd start" with timeout 60 seconds
>       stop program  = "/etc/init.d/httpd stop"
>       if failed port 80 then restart
>       if failed port 443 with timeout 15 seconds then restart
> ...
> </quote from wiki>
> 
> Reason:
> Its not easy to estimate the timeout for some service, 
> but I guess the "restart/reload" program will handle this.
> 
> Monit assumes the process to stop in given time i.e 30s
> (eg. I have noticed serveral times for apache2 atleast)
> What happens when the given process does not stop in 30s ?
> 
> -- 
> Regards.
> V.Krishn


The stop/start timeout is just deadline - when the stop program is executed, 
Monit observes the process and waits for it to stop. The stop is usually fast 
(for example 1 second) and the process will disappear from the process table - 
Monit will notice it and the stop wait is finished. Then it executes the start 
program and again waits up to given timeout for the process to show up in the 
process table. The default is 30 seconds which is good for most processes - you 
can override the timeout if needed.

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.

Regards,
Martin






reply via email to

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