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
sudo tee /etc/monit/slack-url <<EOF
https://hooks.slack.com/services/XXXXXX/YYYYYY/XyXyY123xxxY
EOF