Custom alert channels

Issue #416 on hold
Don created an issue

Sometimes, it's useful not to send alert via email, but to act directly on service state, for example send SMS or instant message. With exec action it is not achievable, because, it only acts on fault and not on service restoration. Thinking about this problem, I thought it would be useful to have special URLs in place of emails to use as alert targets.

For example, to define alert exec:/root/sms-script.py and when any event is happened, instead of sending email, script /root/sms-script.py is executed with MONIT_ env variables.

This will spare people from writing email2sms, email2whatsever gateways. Also, this remove complicated SMTP system from alert path. And will simplify coding, as no need to parse message, but just use well defined env variables. (You could also add env variable to signal this is failure or restoration event.)

Comments (12)

  1. Don reporter

    Hmm. After testing, it seems that exec action is executed every cycle. Was there a bug in monit 5.14 or I missed something? man monit on the system doesn't state that "[t]he program is by default executed only once, on the state change" unlike last web doc does.

    Test is like this:

    check host xx.xx with address x.x.x.x
      if failed port 80 protocol http for 3 cycles then exec /root/send-sms.rb
        else if succeeded then exec /root/send-sms.rb
    
  2. Karthik T

    @Tildeslash I am not clear on the status here. Is it something that Will not be done? Accepting PRs? Waiting to be done? Any reasons to the status?

  3. Tildeslash repo owner

    @Karthik T no. We want to make generic interface that’ll allow you to use choose the alert channel for each test

  4. Log in to comment