Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 1.02 KB

README.md

File metadata and controls

29 lines (20 loc) · 1.02 KB

monit2sns

A simple script to send Monit alerts using AWS SNS.

By default, Monit only sends alert notifications via email. But we can also set 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 AWS SNS.

This script is inspired by Monit2Twilio and monit2telegram

How to install

  1. Edit monit2snsrc configuring region and topic ARN
  2. chmod +x sendsns.sh
  3. Copy sendsns.sh to /usr/local/bin: cp sendsns.sh /usr/local/bin
  4. Optionally copy config file to /etc: cp monit2snsrc /etc/monit2snsrc

How to execute script

After installing the script:

sendsns.sh -m "message to send to topic ARN" -c monit2snsrc

If the config file is copied to /etc/monit2snsrc:

sendsns.sh -m "message to send to topic ARN"