A simple script to send Monit alerts to you via SMS with Twilio.
Shell
Latest commit 2fc0aa8 Oct 7, 2014 @alexdunae Merge pull request #1 from parallel588/master
fixed curl command, added --data-urlencode
Permalink
Failed to load latest commit information.
LICENSE First commit Apr 28, 2014
README.md First commit Apr 28, 2014
monit-example.conf First commit Apr 28, 2014
monit2twilio.sh First commit Apr 28, 2014
playbook.yml First commit Apr 28, 2014
twilio-sms.sh fixed curl command, added --data-urlencode Oct 3, 2014
twiliorc First commit Apr 28, 2014

README.md

Monit2Twilio

A simple script to send Monit alerts to you via SMS with Twilio.

Monit only sends alert notifications via email out of the box, but also provides a hook to execute a script. When executing the script, Monit sets a few environment variables about the alert.

This tiny script transforms those variables into a text message and pipes them to Twilio's twilio-sms bash script for delivery.

Usage

Put your Twilio credentials in twiliorc and upload it to the user's home directory (probably root, since Monit runs as root).

Upload twilio-sms and monit2twilio to /usr/local/bin and make them executable (e.g. 0755).

Then, wire up any Monit alerts that you'd like:

check file nginx.pid with path /var/run/nginx.pid
  if changed timestamp then exec "/usr/local/bin/monit2twilio" as uid root and gid root

There's also an Ansible playbook if you're so inclined.

Delightful!