Skip to content

Instantly share code, notes, and snippets.

@alexdunae
Created June 25, 2014 23:32
Show Gist options
  • Save alexdunae/eea65e2a0c2adcc916e6 to your computer and use it in GitHub Desktop.
Save alexdunae/eea65e2a0c2adcc916e6 to your computer and use it in GitHub Desktop.
Get Monit notifications via SMS
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
#!/bin/bash
#
# Monit EXEC handler that sends monit notifications via SMS
#
# Depends on having `twilio-sms` installed and a config file in `/root/.twiliorc`
#
# See also
# - https://www.twilio.com/labs/bash/sms
# - https://github.com/alexdunae/monit2twilio
message="Monit: $MONIT_SERVICE - $MONIT_EVENT at $MONIT_DATE on host '$MONIT_HOST': $MONIT_DESCRIPTION."
echo $message | /usr/local/bin/twilio-sms -c /root/.twiliorc {{ monit_twilio_sms }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment