Reputation: 117
I'm using the resource monitoring tool Munin. (Version 1.4.6)
Today I've enabled the email alert function to receive a notification when a value is too high.
With munin it is possible to set two levels of alerting. (Warning or Critical)
I've configured the munin.conf file like this:
contact.scs.command mail -s "Munin notification ${var:host}" [email protected]
[varnish;server01.domain.net]
address server01.domain.net
use_node_name yes
cpu.iowait.warning 14
cpu.iowait.critical 17
cpu.contacts scs
When a performance value exceeds the defined maximum, a mail notification with the alert will be successfully send. :-)
Now to my Question:
Would it be possible to send a critical notification to a different mail address than the warning notification?
Unfortunately I couldn't find anything at web.
I've already tried this, but it didn't work for me:
contact.scs.command mail -s "Munin notification ${var:host}" [email protected]
contact.crit.command mail -s "Munin notification ${var:host}" [email protected]
[varnish;server01.domain.net]
address server01.domain.net
use_node_name yes
cpu.iowait.warning 14
cpu.iowait.critical 17
cpu.contacts scs
cpu.contacts.warning scs
cpu.contacts.critical crit
Thanks for help!
Upvotes: 2
Views: 5463
Reputation: 129
Unfortunately munin doesn't support this and its documentation is very poor. But it's possible to do it via workaround. My case below is little bit more complicated, I have to first ssh to another machine, since in my case mail cannot be sent directly from munin machine. But it's of course possible to simplify it without using ssh.
contact.email.command ssh [email protected] "cat > /tmp/muninmail.txt; bash -c \"if grep -q CRITICAL /tmp/muninmail.txt; then cat /tmp/muninmail.txt | mail -s 'Munin-notification for ${var:group} :: ${var:host}' [email protected]; fi\"
Without ssh, something like this should do it, but I haven't tested this case:
contact.email.command bash -c "cat > /tmp/muninmail.txt; if grep -q CRITICAL /tmp/muninmail.txt; then cat /tmp/muninmail.txt | mail -s 'Munin-notification for ${var:group} :: ${var:host}' [email protected]; fi"
Upvotes: 1
Reputation: 1482
Here's a guess for you. For all the warning-only contacts:
contact.scs.command mail -s "Munin notification ${var:host}" [email protected]
contact.scs.always_send warning
For all the critical-only contacts:
contact.crit.command mail -s "Munin notification ${var:host}" [email protected]
contact.crit.always_send critical
For any warning-and-critical contacts:
contact.other.command mail -s "Munin notification ${var:host}" [email protected]
contact.other.always_send warning critical
Upvotes: 0