monit-general
[Top][All Lists]
Advanced

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

Re: Monit definitely not waiting for stop scripts to complete


From: Stanisław Trytek
Subject: Re: Monit definitely not waiting for stop scripts to complete
Date: Thu, 06 Sep 2007 13:00:12 +0200
User-agent: Opera Mail/9.20 (Linux)

Hi,
I would like to share my opinion as one of monit users.
We consider monit as a great tool but lack of synchronous starting causes that we can not use it as it is.
It would be enough for me to have one option, for instance:

SynchDependency = 0/1  // or whatever other option

And then optionally make monit to wait for service to start.
In that case, dependency should be crucial, if parent does not start then it is useless to start child processes. If monitored service blocks, after a declared timeout, Monit should alert that a service has not started yet. I would not rely on whether pid file exists or not. Just wait for start script to finish and check result.

An additional configuration option would not interfere with what people are using now.

Stanislaw Trytek

On Thu, 06 Sep 2007 08:18:08 +0200, Martin Pala <address@hidden> wrote:


On Sep 5, 2007, at 6:47 PM, Jason L. Buberel wrote:

Jan-Henrik, Stanislaw,

Thanks for your thoughtful consideration/response.

Question #1) Maybe start time is not the crucial point here, but rather "correctness", that is, monit should wait for A to come up before starting B and so on?

My Answer) My preference would trust the start/stop script with the responsibility of determining when it has completed its processing and the service is fully started or stopped. Monit's approach - detecting the presence of the PID and the process - takes that responsibility away from the script. For most services, that assumption is a safe one. But there are many cases of more complex services for which process creation and PID file creation happen well before that service is fully started. For that reason, I would vote in favor of making all start/stop actions synchronous. If you are concerned with start/stop scripts taking too long to completed, I would suggest the use of a timeout value:

check process tomcat with pidfile /var/run/tomcat.pid
        stop program with timeout 30 seconds = "/etc/init.d/tomcat stop"
        start program with timeout 30 seconds = "/etc/init.d/tomcat start"
If the start/stop script does not exit within the timeout period, the execution attempt should be considered to have failed.

Yes, there is part of framework for start/stop programs timeout - it is counted in cycles => the syntax looks like:

--8<--
   check process tomcat with pidfile /var/run/tomcat.pid
stop program with timeout 30 seconds = "/etc/init.d/tomcat stop" with timeout 1 cycles # this is default => the timeout option not needed start program with timeout 30 seconds = "/etc/init.d/tomcat start" with timeout 5 cycles # after service is started, provide up to 5 cycles to start
--8<--

I think we should start/stop the program as we do now (fork and don't wait for script to finish) and use monit checks to see whether the service is online or not, considering the cycles timeout.

The dependency level (hard or soft) then says whether the services should be started synchronously or asynchronously in the case that dependency is used. Example syntax:

--8<--
   check process friend with pidfile /var/run/friend.pid
       ...

   check process parent with pidfile /var/run/parent.pid
       ...

   check process child with pidfile /var/run/child.pid
       ...
      depends on parent hard
depends on friend soft # this is default => the dependency level option not needed
--8<--


Martin




--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general



--
_________________________________________
PRZEMYSŁOWY INSTYTUT TELEKOMUNIKACJI
TELECOMMUNICATIONS RESEARCH INSTITUTE
ul. Poligonowa 30,  04-051 Warszawa,  Poland
tel: +48 (22) 48 65 232
fax: +48 (22) 48 65 494
e-mail: address@hidden




reply via email to

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