monit-general
[Top][All Lists]
Advanced

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

monit watchdog timer restart


From: Peter Holdaway
Subject: monit watchdog timer restart
Date: Tue, 24 Feb 2004 12:59:02 -0800

Hi,

  I would like some advice on the simplest way to implement a watchdog timer
restart of a process. Perhaps this could also be added to the documentation
too.

  I have a process that should be regularly updating a file. If it is not I
can assume the process is broken and should be restarted. In the absence of
a network protocol, this is often the easiest way to instrument a process
for monitoring its readiness to perform work.


  In version 3.2 of monit this was accomplished by...

check AppManager with pidfile /var/lxs/run/AppManager.pid
    start program = "/opt/lxs/bin/lxs.sh start AppManager"
    stop program = "/opt/lxs/bin/lxs.sh stop AppManager"
    if timestamp "/var/lxs/run/AppManager.monit" > 2 minute then restart


  Is the following the best expression of this problem in monit 4.2 ?


check process AppManager with pidfile "/var/lxs/run/AppManager.pid"
    start program = "/opt/lxs/bin/lxs.sh start AppManager"
    stop program = "/opt/lxs/bin/lxs.sh stop AppManager"

check file AppManager_monit with path "/var/lxs/run/AppManager.monit"
    if timestamp > 2 minutes then exec "/opt/lxs/bin/lxs.sh stop AppManager"
    depends on AppManager


Notice the unusual direction of the dependency. There do not seem to be any
examples of this in the documentation.

This dependency is required so that when "monit stop AppManager" is issued
then the AppManager_monit service is also stopped.

This solution requires two time periods to restart the process, one for the
timestamp and one for the process restart.


TIA

  Peter





reply via email to

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