Saturday, August 16, 2008

example for munin-nagios integration

Let's assume that you have an USB temperature sensor connected to a machine in your server room.
Active checks would make no sense here, since most of the time the temperature should be OK.
But you want to get notified in case of cooling problems and over heating.




First you need a plugin for munin:
serverroom



Verifiy that this plugin is working prior doing anything else!
Also adopt the warn and crit values to your needs.

Now you need nsca installed on your munin master node.

Next
step is a proper munin master configuration for your system that has
the USB thermometer connected. We assume that the system has the name
intranet and that you have configured munin to make use of some
domains. intranet is located in domain intern.

contact.nagios.command /usr/sbin/send_nsca -H <nagios server IP> -c /etc/send_nsca.cfg
[intranet.intern]
        notify_alias intranet
        address <your systems IP>
        use_node_name yes

If you omit the "notify_alias" part all alarms will be sent from the given system name  plus domain appended (intranet.intern).
With the notify alias you can make sure that nagios receives the alarm for the proper system.

Now the nagios system needs to get configured.
Make sure you have nsca installed and running.
Now enable passive chacks in nagios.conf and create a service for the temperature alarm:

define service{
        use                             passive-service
        hostgroup_name                  temperature-servers
        service_description             Serverroom
                check_command                   return-ok
        }