monit-general
[Top][All Lists]
Advanced

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

RE: Configuring monit to call an external program (EXEC) as well as r e


From: Tom O'Brien
Subject: RE: Configuring monit to call an external program (EXEC) as well as r estart etc
Date: Tue, 8 Feb 2005 18:26:12 -0500

Thanks that clarifies things Martin.

I'd certainly support adding more flexibility to the configuration file, to allow any default behaviour to be overridden. I don't know how generally useful this would be, but it would help me in my situation! :-)

Tom.

-----Original Message-----
From: address@hidden [mailto:address@hidden] On Behalf Of Martin Pala

Sent: Tuesday, February 08, 2005 4:15 PM
To: This is the general mailing list for monit
Subject: Re: Configuring monit to call an external program (EXEC) as well as r estart etc


Ah so ... sorry i didn't saw what exactly you meant ;)

The "NONEXISTENT" event generated by monit has implicit event handler
actions for failed and recovered state.

The default action for 'failed' state is to do restart (restart alert is
send as well), which means executing of stop & start programs defined
for the service:

   start program = "..."
   stop  program = "..."

The default action for 'recovered' state is to send alert.

It is currently not possible to override default actions for NONEXISTENT
event type. However, the modification of monit to support the implicit
action overloading is quite easy - the implicit action overloading is
used in PID and PPID events types already (part of upcoming monit-4.5).

Maybe it could be good to add the support for such rules (optional
overloading of implicit event actions) ...


Martin



Tom O'Brien wrote:
> Thanks for your response.
>
> I think I'm still in a pickle! I cannot see how to catch the
> "nonexist/exists" event. IE: I have the following statements in monitrc...
>
> Check process X with pidfile /home/xrunner/x.pid
>         start program = ...
>         stop program = ....
>       
> Monit doesn't allow me to use:
>         if nonexist then... OR
>         if failed nonexist... OR
>         if failed exist... OR
>         if exist...
>
> I can add an alert indication to my "start program = " script, but
> that
> won't indicate when monit detects that the process "exists" again...only
> when monit thinks it needs to restart the process.
>
> Almost there; thanks for your help!
> Tom.
>
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden] On
> Behalf Of Martin Pala
>
> Sent: Monday, February 07, 2005 4:57 PM
> To: This is the general mailing list for monit
> Subject: Re: Configuring monit to call an external program (EXEC) as
> well as r estart etc
>
>
> There is one planned feature, which should do what you asked for:
> http://www.tildeslash.com/monit/doc/next.php#21
>
> Currently the workaround is possible using exec action this way
> (symbolic example):
>
>   if failed <test>
>      then exec "/bin/bash -c '/bin/snmptrap <...>; /bin/monit restart
> <myservice>;'"
>      else if recovered then exec "/some/other/script"
>
> As you can see, monit starts shell, which then interpretes the
> commands. One of them is the execution of monit binary (aka client),
> which contacts the monit daemon in turn and instructs it to restart
> the given service (i.e. "loopback" trick).
>
> The default action on error recovery is alert (unless you want to do
> other action then alert, you can omit it).
>
> There may be several other ways how to implement the workaround (as
> you noted).
>
> Martin
>
> Tom O'Brien wrote:
>  > Hi all:
>  > In reading the mailing list archives (search for SNMP), Martin Pala 
> > seemed to imply that it was possible to call an external program
> (such  > as snmptrap) from monit, when a state change occurred.  >
>  > I can see it is possible to call an external program through the EXEC
>  > action; however it does not seem possible to call EXEC, and also take
>  > built in actions such as "restart", or "timeout". Basically I want the
>  > EXEC to replace the alert! I'm using monit 4.3 currently.
>  >
>  > Is this a correct read of monit's capabilities?
>  >
>  > Is there any round-about way to do what I need?
>  > - I've tried sending alerts to a localhost address, then parse the
>  > message to generate the alert I want; however because monit goes direct
>  > to port 25, I cannot use it (my smtp service may be heavily loaded, and
>  > non-responsive).
>  >
>  > - I've considered polling the HTTP server, but I may miss state
>  > changes.
>  > - Are all state changes written to the monit log? I suppose I could
>  > write a log monitor! Gack.
>  >
>  > Thanks for a very useful tool!
>  >
>  > Tom.
>  >
>  >
>  > ----------------------------------------------------------------------
>  > --
>  >
>  > --
>  > To unsubscribe: http://lists.nongnu.org/mailman/listinfo/monit-general
>
>
> --
> To unsubscribe: http://lists.nongnu.org/mailman/listinfo/monit-general
>
>
> ----------------------------------------------------------------------
> --
>
> --
> To unsubscribe: http://lists.nongnu.org/mailman/listinfo/monit-general


--
To unsubscribe: http://lists.nongnu.org/mailman/listinfo/monit-general


reply via email to

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