Monitoring Ubuntu system with Monit and sending alerts in Slack

Monit

sudo apt install monit -y

monit --version

Slack

  • Create an app
  • Activate incoming webhooks (by installing the app to your workspace)
  • Select an existing channel or create a new one (e.g. #monit)
# test the Webhook by sending sample data
curl -X POST -H 'Content-type: application/json' --data '{"text":"Hello, World!"}' https://hooks.slack.com/services/XXXXXX/YYYYYY/XyXyY123xxxY

This will post a fairly straight forward Hello, World! message to your channel

monit-slack-message-screenshot

sudo tee /etc/monit/slack-url <<EOF
https://hooks.slack.com/services/XXXXXX/YYYYYY/XyXyY123xxxY
EOF

Links

Please note that this site and the posts on it are, and will always be, a work in progress. If i waited for perfection, i’d never get anything done.