by Other Media
Send Munin notifications to email, HipChat and Slack!
Pull requests are welcome for fixes, tweaks or additional targets.!
-
Install PyYAML (
yum install PyYAML
/apt install python-yaml
/pip install pyyaml
) -
Install mutt (
yum install mutt
/apt install mutt
) -
Save munin-notify.py to /etc/munin
-
Chmod munin-notify.py to 0755
-
Add the following to /etc/munin/munin.conf:
contact.alerts.text ${var:group} / ${var:host} / ${var:graph_category} / ${var:graph_title}\n\ ${loop<\n>:wfields WARNING / ${var:label} / ${var:value} / ${var:wrange} / ${var:extinfo}}\n\ ${loop<\n>:cfields CRITICAL / ${var:label} / ${var:value} / ${var:crange} / ${var:extinfo}}\n\ ${loop<\n>:ufields UNKNOWN / ${var:label} / ${var:value} / - / ${var:extinfo}}\n\ ${loop<\n>:fofields FIXED / ${var:label} / ${var:value} / - / ${var:extinfo}}\n contact.alerts.command /etc/munin/munin-notify.py --log-file /var/log/munin/munin-notify.log
-
Configure your alert targets in /etc/munin/munin-notify.yml
targets: - type: email recipients: [ [email protected] ] - type: hipchat room: 123456 token: abcdef0123456789abcdef0123456789 - type: slack channel: '#general' webhook_url: http://slack/webhook/url
There are several known issues with Munin's alerting. It's recommended that you apply the following patches to your Munin installation if necessary to ensure that alerting is accurate.
- 'FIXED' notifications do not work correctly (fixed in future Munin 2.0.26 - patch available at munin-monitoring/munin#334)
- Inherited alert thresholds do not produce alerts (fixed in future Munin 2.0.26 - patch available at munin-monitoring/munin#362)