[Top][All Lists]

[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 es

From: Martin Pala
Subject: Re: Configuring monit to call an external program (EXEC) as well as r estart etc
Date: Mon, 07 Feb 2005 22:57:16 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050105 Debian/1.7.5-1

There is one planned feature, which should do what you asked for:

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).


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!



To unsubscribe:

reply via email to

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