monit-dev
[Top][All Lists]
Advanced

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

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


From: Andrew Forward
Subject: [monit-dev] Forked project on github.com and added a "set exec" feature
Date: Thu, 28 Jul 2011 11:32:20 -0400


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

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]