[Top][All Lists]

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

Re: Unable to exec external script

From: Dragan Zubac
Subject: Re: Unable to exec external script
Date: Fri, 15 Dec 2006 14:30:47 +0100


Thanx for the info,I guess there was a problem with 'RTFM' problem as always :)
Anyway,what am I trying to accomplish ?
Have a certain processes which doesn't genereate their own PID's,so wrote a little wrapper around them,no problem.The problem is how to configure monit to execute external shell script if some processes was restarted let's say 5 times in 2 cycles or so ? I don't want the alerts to be spam each time the process is restarted,but if there was N times in M cycles,execute some external script which should send me process's log file with explanation of restart reason ?
Second ones,is there a possibility to configure multiply mail formats for different process checks or something similar ? process-N send mail format-N or ? Or maybe different mail layout for different service tests ?



On 12/11/06, Martin Pala <address@hidden> wrote:
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


Dragan Zubac wrote:
> Hello
> 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 ?
> Sincerely
> Dragan
> On 12/6/06, *Martin Pala* <address@hidden
> <mailto: address@hidden>> wrote:
>     Hello,
>     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.
>     Thanks,
>     Martin
>     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

To unsubscribe:

reply via email to

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