[Top][All Lists]

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

problem using check file to exec script if (*manual* mode process) has x

From: Alex Stewart
Subject: problem using check file to exec script if (*manual* mode process) has x restarts in y cycles
Date: Tue, 11 Sep 2007 23:42:51 -0400

Dear All,

I want to make monit execute a script if a particular service is
restarted x times in y cycles, from reading the mailing list, the
following suggestion using a check on the timestamp on the pid file of
the process was suggested:

  check file myprocpid with path /var/run/
    if changed timestamp 2 times within 5 cycles then exec '...'

BUT - the problem I'm having with this is that in my case the service
in question is in mode manual, and hence the pid file does not (and
should not) exist until monit is asked to start the group which
contains the process.  The fact that the file is not present when
monit is started appears to upset the daemon (it exits:  Error: the
path '/var/run/bfrt-monit/pid-files/' used in the
TIMESTAMP statement does not exist 'shutdown') even though I have
'mode manual' (and 'group testGroup' - which is not started when the
daemon is started by init) in the check file statement which is:

check file testMat_pidfile with path /var/run/bfrt-monit/pid-files/
   if changed timestamp 3 times within 12 cycles then exec
"/usr/local/bfrt-monit/scripts/nodeControl shutdown"
   mode manual
   group testGroup

I have tried swapping the pid file path for the path to a text file
that does exist when the daemon starts up, and monit duly starts as
usual and the web interface indeed shows that testMat_pidfile has a
status of 'not monitored' (i.e. the desired behaviour) - but I don't
know how to make it work with the pidfile case.

Does anyone know what I'm doing wrong? (sorry if the answer is
trivial, lots of people must have done this, but I haven't been able
to find a solution)


reply via email to

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