07.13.06

Posted in Quick Guides at 4:42 pm by jasonb

Munin has support for sending mails when specified warning and critical thresholds are exceeded. If you aren’t already running a notification system, such as Nagios, Munin’s notification works splendidly. A few changes to munin.conf are all that’s needed.

First, you need to configure contacts, which enables the notification system.

contacts me
contact.me.command mail -s "Munin notification ${var:host}" user@host.tld
contact.me.always_send warning critical

Above, I define a contact entry named, aptly, me. Pick any name you would like. Next, the specific command action is defined. It’s really just a string to be executed by a shell which will receive the body of the alert message as STDIN. For sending email an appropriate command such as mail is used. Finally, mails will always be sent on any warning or critical state.

Next, recognize that alerts will only be sent for plugins that actually provide warning and critical values. A few of the default plugins do, the rest do not. What’s more, appropriate thresholds may vary by machine. Fortunately, you can define thresholds per plugin per host though how isn’t entirely explained in the documentation.

[foo.example.com]
        address 127.0.0.1
        use_node_name yes
        df._dev_sda1.warning 97
        hddtemp_smartctl.hde.critical 41
#     This won't work
#     hddtemp_smartctl.*.critical 41

In munin.conf, for each node of interest, you can define specific threshold values for a given host or override values provided by any plugin that already includes thresholds in its output. The format is plugin.fieldname.{critical,warning} value. You can find the fieldnames in the HTML graph views for fieldnames that are determined at configuration time by the plugin.

Above, the default warning threshold for the df plugin of 92 is overridden with 97. (In this case, it’s the % full output from the df command.) Additionally, a temperature threshold for critical is provided for the hddtemp_smartctl plugin, which does not specify one by default. A different value can be specified per host. I couldn’t specify thresholds globally per plugin for plugins that had no default. You must edit the plugin itself and redstribute it to monitored systems for new global defaults.

2 Comments »

  1. beanie said,

    April 8, 2007 at 1:03 pm

    big thanks for this easy-to-use howto. munin is a very usefull tool!

    thx
    beanie

  2. Nirav said,

    May 15, 2007 at 4:26 am

    Thanks for to-the-point guide .. worked with gnokii .. for sending SMS

    thanks
    Nirav

Leave a Comment

Stop spam with the glaring, voluminous, and red-hot desperate WP Hashcash!