Monitoring Ubuntu system with Monit and sending alerts in Slack
May 12, 2020
Monit
code
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)
code
# 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

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