Slack as alternative to e-mail warnings.
Posted on January 19, 2017 • 1 minutes • 170 words • Suggest Changes
When monitor systems are made, there are only a few options, e-mail, telephone and some constricting alternative nobody ever heard off. Well goodbye to those. E-mails get lost, or in spam, telephones are fine, only Y2K skype called, and they want there platform back. So here goes my next attempt : slack 🙂 LibreNMS already polls all my devices over the network, and can report straight to slack. (and also e-mail and 50 other options) Time to also update my emailing cron jobs to slack’s.
I used slack for bash, written by Sul Aga. Using it is easy :
Install
cd /opt git clone https://github.com/sulhome/bash-slack ln -s /opt/bash-slack/postToSlack.sh /usr/local/bin/postToSlack
**Use **
postToSlack.sh -t "title of your message" -b "content of the message" -c "serverroom_channel" -u "https://hooks.slack.com/services/..." > /dev/null
The URL can be generated from an incoming webhook. Messages look like this :
Note that the output will tell you the status code (200: OK) I ignore it, since there is no other way then to … mail on failure ?