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: Martin Pala
Subject: Re: Monit definitely not waiting for stop scripts to complete
Date: Thu, 6 Sep 2007 08:18:08 +0200


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






reply via email to

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