monit-general
[Top][All Lists]
Advanced

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

monit usage question


From: Elisabeth Gutierrez
Subject: monit usage question
Date: Tue, 27 Mar 2007 16:59:48 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 (CK-LucentTPES)

Dear Monit Experts,

I'm working with monit for the first time. I've looked through the documentation
and the FAQ as well and have taken some helpful hints from what I'm trying to
do. I do have a question for the FAQ question 13. I'm setting up to startup
monit as part of the /etc/inittab and I'm following suggestion 7c to wait some
time before monit starts monitoring the process I want monitored.

I'm following suggesting 13 b/c I also wanted to do something for the process
I'm monitoring to execute external command after so many restarts.

The question I have is that I'm setting a flag when doing item 13 in FAQ as 
follows:

check file chk.stat with path /root/chk.stat
        if timestamp < 10 seconds for 2 cycles then "execute command that sets 
flag"

(chk.stat is in the startup script of my process)

and when check the process I want to execute the command that clears the flag
when the process is running again. I do the following:

check process myprocess with pidfile /root/myprocess.pid
        start program="/etc/init.d/myprocess start"
        stop program="/etc/init.d/myprocess stop"
        if changed pid then exec "command to clear flag"

The goal I want to get to is that, "if my process restarts 2 in 2 cycles, set a
flag. Once I know it is successfully running, then clear the flag (i was using
the changed pid in the check process)." In addition, want to prevent the race
condition of when monit should start monitoring the process so implemented 7c
from FAQ as follows:

check file myprocess.pid with path /root/myprocess.pid
        if timestamp > 5 minutes then
                        exec "/bin/bash -c '
                                        /usr/local/bin/monit -c /etc/monitrc 
monitor myprocess;
                                        /usr/local/bin/monit -c /etc/monitrc 
unmonitor myprocess.pid;
                                        '"

I want to prevent that clearing the flag doesn't happen before the setting of
the flag. Does anyone have any suggestions?

Thank you,
Elisabeth









reply via email to

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