Integrate Munin and Nagios3 on Ubuntu 12.04

You can integrate your Mumin performance monitoring with Nagios which is really useful, as you can get alerted when performance thresholds are breached.

Installing Munin

First install the Mumin Package

sudo apt-get install munin

Now you need to change the default ‘Localhost’ server name to reflect your server name:

sudo nano /etc/munin/munin.conf

Edit the following:

# a simple host tree
[servername.domain.com]
address 127.0.0.1
use_node_name yes

You will need to wait for about 5 minutes now while Munin starts to generate data.

Intregrating with Nagios

To Inregrate with Nagios we are going to use a plugin called check_munin_rrd which can be found on the following website:

http://exchange.nagios.org/directory/Plugins/Operating-Systems/Linux/check_munin_rrd/details

cd /usr/lib/nagios/plugins
sudo wget http://blogs.barlow.uk.net/content/downloads/check_munin_rrd.pl
sudo chmod +x ./check_munin_rrd.pl

To get the full set of syntax/paramenters you can run the following

./check_munin_rrd.pl --help

You can test by using the following syntax (change the -H and -d to your host name and domain details setup in your /etc/munin/munin.conf.

./check_munin_rrd.pl -H server.domain.com -d domain.com-M postfix_mailvolume -o volume -w 1 -c 2

You can now call this plugin script and pass it parameters to monitor.  To get this working I created a Nagios Monioring plugin:
sudo nano /etc/nagios-plugins/config/munin.cfg

and wrote the following to this file:

# 'check_munin_mailvolume' command definition
define command {
command_name    check_munin_mailvolume
command_line    /usr/lib/nagios/plugins/check_munin_rrd.pl -H server.domain.com -d domain.com-M postfix_mailvolume -o volume -w '$ARG1

Now you can call this newly made plugins from your Nagios setup:




cd /etc/nagios3/conf.d/

I have a config file for each server (but you can edit the approriate file)

sudo nano server.cfg

Add the following lines:

# Check Munin Mail Volumes
define service {
service_description             Munin Postfix Mail Volumes
check_command                   check_munin_mailvolume!90!100
use                             generic-service
host_name                       changuk2.ba.low.eu
}

# Check Munin Mail Queue
define service {
service_description             Munin Postfix Mail Queue
check_command                   check_munin_mailqueue!1!2
use                             generic-service
host_name                       changuk2.ba.low.eu
}

# Check Munin Apache Volume
define service {
service_description             Munin Apache Volume
check_command                   check_munin_apachevolume!16000!17000
use                             generic-service
host_name                       changuk2.ba.low.eu
}

Now restart Nagios3 service to apply the changes

sudo service nagios3 restart

Your setup is now complete, and if you check your Nagios web console you should see the new services we have just added.

References: http://www.sysadmin-fr.org/en/book/export/html/303

 

-c '$ARG2Now you can call this newly made plugins from your Nagios setup:


I have a config file for each server (but you can edit the approriate file)


Add the following lines:


Now restart Nagios3 service to apply the changes


Your setup is now complete, and if you check your Nagios web console you should see the new services we have just added.

References: http://www.sysadmin-fr.org/en/book/export/html/303

 

}

# 'check_munin_mailqueue' command definition
define command {
command_name    check_munin_mailqueue
command_line    /usr/lib/nagios/plugins/check_munin_rrd.pl -H server.domain.com -d domain.com -M postfix_mailqueue -w '$ARG1Now you can call this newly made plugins from your Nagios setup:


I have a config file for each server (but you can edit the approriate file)


Add the following lines:


Now restart Nagios3 service to apply the changes


Your setup is now complete, and if you check your Nagios web console you should see the new services we have just added.

References: http://www.sysadmin-fr.org/en/book/export/html/303

 

-c '$ARG2Now you can call this newly made plugins from your Nagios setup:


I have a config file for each server (but you can edit the approriate file)


Add the following lines:


Now restart Nagios3 service to apply the changes


Your setup is now complete, and if you check your Nagios web console you should see the new services we have just added.

References: http://www.sysadmin-fr.org/en/book/export/html/303

 

}

# 'check_munin_apachevolume' command definition
define command {
command_name    check_munin_apachevolume
command_line    /usr/lib/nagios/plugins/check_munin_rrd.pl H server.domain.com -d domain.com -M apache_volume -o volume -w '$ARG1Now you can call this newly made plugins from your Nagios setup:


I have a config file for each server (but you can edit the approriate file)


Add the following lines:


Now restart Nagios3 service to apply the changes


Your setup is now complete, and if you check your Nagios web console you should see the new services we have just added.

References: http://www.sysadmin-fr.org/en/book/export/html/303

 

-c '$ARG2Now you can call this newly made plugins from your Nagios setup:


I have a config file for each server (but you can edit the approriate file)


Add the following lines:


Now restart Nagios3 service to apply the changes


Your setup is now complete, and if you check your Nagios web console you should see the new services we have just added.

References: http://www.sysadmin-fr.org/en/book/export/html/303

 

}
Now you can call this newly made plugins from your Nagios setup:


I have a config file for each server (but you can edit the approriate file)


Add the following lines:


Now restart Nagios3 service to apply the changes


Your setup is now complete, and if you check your Nagios web console you should see the new services we have just added.

References: http://www.sysadmin-fr.org/en/book/export/html/303