[Top][All Lists]

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

Re: Unable to exec external script

From: Martin Pala
Subject: Re: Unable to exec external script
Date: Mon, 11 Dec 2006 17:59:37 +0100
User-agent: Thunderbird (Windows/20061025)

Thanks for the input :)

The problem is in the "if changed pid ..." statement usage. It comes true only if the monitored process PID changed without monit control - during the sleep between the monitoring cycles. If then monit wakes up and detects that the PID of the process is different since the last cycle, then it evaluates the "if changed pid ..." action.

In your case the process failed at all (didn't exist), thus monit performed the restart action. The PID will change of course, but this change is expected by monit, because monit drives the restart.

The "if changed pid ..." statement description (excerpt from monit manual):

This test is useful to detect possible process restarts which has occurred in the timeframe between two monit testing cycles. In the case that the restart was fast and the process provides expected service (i.e. all tests passed) you will be notified that the process was replaced.

For example sshd daemon can restart very quickly, thus if someone changes its configuration and do sshd restart outside of monit control, you will be notified that the process was replaced by new instance (or you can optionaly do some other action such as preventively stop sshd).

Another example is MySQL Cluster which has its own watchdog with process restart ability. You can use monit for redundant monitoring. Monit will just send alert in the case that the MySQL cluster restarted the node quickly.


Dragan Zubac wrote:

Sure thing,here's the whole test setup:

a. application to be monitored is called (basically every second echo date command output to some /tmp/program.out file),the program itself does not set up it's own pid

b. start up script is called with start/stop switch,and it's also a wrapper around application handling pid's and stuff like that

In attachment is also :

a. monit.log file,during a couple of cycles where I changed exec action directive in monitrc command to explicitly use bash shell - filename monit.log
b. first monitrc file (before modification) - filename monitrc~
c. second monitrc file (after modification) - filename monitrc
d. script to be execute on event (changed pid in this case) which can accept optional parameter
    - filename
e. monit -vI output file - filename monit.out

During test I monitored /tmp/helo.out which is a file where goes output of external script to be execured each time a pid is changed of monitored application (,and there was nothing indicating that monit even tried to execute script on changed pid event. I even tried to strace monit's child process after monit startup,but in logs there was no presence of
The system I'm using is SuSE v9.3,default installation.

Am I missing something or some other mistake I make ?



On 12/6/06, *Martin Pala* <address@hidden <mailto:address@hidden>> wrote:


    can you describe the configuration and situation where you expect the
    exec to happen in more detail? Also the log output from monit verbose
    mode (-v option) could be useful.


    Dragan Zubac wrote:
     > Hello
     > I'm trying to configure monit software ver. 4.8.1,and was unable to
     > configure moinit to exec some external script on certain events.Tried
     > the following scenarios:
     > a. exec "/path/to/script"
     > b. exec "/bin/bash -c '/path/to/script' "
     > also tried to strace monit while active,and turning on the debuging
     > while active,but couldn't find any attempt to start this script ?
     > Any clue ?
     > Sincerely
     > Dragan

reply via email to

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