monit-dev
[Top][All Lists]
Advanced

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

Re: [monit-dev] Forked project on github.com and added a "set exec" feat


From: Jan-Henrik Haukeland
Subject: Re: [monit-dev] Forked project on github.com and added a "set exec" feature
Date: Thu, 28 Jul 2011 22:52:36 +0200

On Jul 28, 2011, at 5:32 PM, Andrew Forward wrote:

> 
> I forked the monit project and put up my changes on github.com.  
> https://github.com/aforward/monit
> 
> I was looking for a feature similar to the one requested below:
> 
>   "What I would like to do is: whenever I type "alert", send an e-mail AND 
> run a certain script." 
>   http://mmonit.com/wiki/Monit/Suggestions
> I am not a C/C++ developer so the implementation if very simplistic and not 
> fault tolerant as shown in the implementation of "exec" when running things 
> like "if failed... then exec".

If you replace alert with exec and have a 'set alert' statement in .monitrc, 
Monit will do this. That is, execute the script and send an alert. Though I 
admit that more flexibility is needed here. We are in the process of rewriting 
Monit (it takes time) and one of the things we plan to fix is to make the alert 
system a plugin-system. So whenever an event is raised, Monit will send the 
event to the alert system which can either send SMTP, a Jabber message, execute 
a script or call a user-written plugin to handle the event. This is what we 
kind of already do in M/Monit and the plan is to port this over to Monit. So I 
don't think we will use your stuff back in Monit, but it is great that you was 
able to fix and modify Monit to suit your needs.


> The patches are available at:
> https://github.com/aforward/monit/commit/cb4e29c7eb2e30dda019ef45b7292efd6f7b200a
> https://github.com/aforward/monit/commit/9e0b768dee115bf20fbe5965503c0588f0160c95
> 
> 
> Here is how the "limited" feature works.
> 
> You can set a global exec, just like you can set a global alert
> 
>   set exec "/usr/local/bin/myscript '$SERVICE: $EVENT'"
> 
> Within the script, you can use the same variables as you can with emails 
> (e.g. $EVENT).  With the line above, whenever an alert is executed it will 
> also check to see if an exec should be executed and will run it.  Again, the 
> implementation is very naive as I simply needed to get something to work.  
> Feedback on improving it and / or helping to integrate back into the core 
> would be great, but if not, we will continue to maintain our fork and 
> integrate changes with SVN on a periodic basis.
> 
> 
> -- 
> aforward





reply via email to

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