Monitoring with Munin

Posted by martijnvanb on Fri 23 May 2008 at 13:47

In this article I will describe how to install munin on 2 computers, but you can add more if you want to, this will allow us to remotely monitor system performance and activity.

Munin communicates in a client daemon way. The master-package is the munin package, it collects data from a local or remote daemon. The daemon is called munin-node the node collects data on the local machine.

munin-node will allow one or more masters to collect data to a central location where the munin master is running.

Now lets get started. First I will describe my situation.:

One computer is called aikido(192.168.1.1) On this computer we will install munin(master) and munin-node(daemon)

Aikido will be our central place for collecting data,you could call this the "server" but I think that is incorrect.

My other computer is called jiu-jitsu(192.168.1.2). On this computer we will only install munin-node(daemon)

Aikido (master and daemon)

Lets start with installing munin and munin-node on aikido:

aikido:~# aptitude install munin munin-node

Apache configuration

By default munin-graphs are public I don't like that, if you don't mind you can skip this part. I will make the munin graphs more private by protecting them with a username and password.

Add this user with:

aikido:~# htpasswd -c /etc/munin/munin.passwd munin
New password: *******
Re-type new password:  *******
Adding password for user munin

Tell apache2 to ask for a username and password for viewing muning graphs:

aikido:~# vi/etc/apache2/sites-available/munin.conf
Alias /munin /var/www/munin/

<directory /var/www/munin/>
        AllowOverride None
        Options ExecCGI FollowSymlinks
        AddHandler cgi-script .cgi
        DirectoryIndex index.cgi
        AuthUserFile /etc/munin/munin.passwd
        AuthType basic
        AuthName "Munin stats"
        require valid-user
</directory>

Enable munin.conf in apache2:

aikido:~# a2ensite munin.conf

Reload apache to activate the new munin config:

aikido:~# /etc/init.d/apache reload
Now our munin-graphs are protected with a username and password.

Configure munin(master)

Each node has to be configured in munin(master) So lets add some daemons to our system:

aikido:~# vi /etc/munin/munin.conf
[aikido]
    address 127.0.0.1
    use_node_name yes

[jiu-jitsu]
    address 192.168.1.2
    use_node_name yes

Configure munin-node(daemon)

A default node will listen on all interfaces, but will only allow clients from localhost. Lets change that to a daemon listening on his own interface(127.0.0.1).

aikido:~# vi /etc/munin/munin-node.conf
change host * to host 127.0.0.1

We made a change to munin-node.conf so we have to restart it:

aikido:~# /etc/init.d/munin-node restart
Now we are finished with the master part.

jiu-jitsu(daemon)

Lets install munin-node:

jiu-jitsu:~#  aptitude install munin-node

Lets change that to a daemon listening on his own interface(192.168.1.2) and only allow a certain master(192.168.1.1) to collect data.

jiu-jitsu:~#  vi /etc/munin/munin-node.conf
change host * to host 192.168.1.2
change allow ^127\.0\.0\.1$ to allow ^192\.168\.1\.1$

We made changes to munin-node.conf so we need to restart munin-node:

jiu-jitsu:~# /etc/init.d/munin-node restart

Plugins

By default munin-plugins are installed in /usr/share/munin/plugins If you want to enable a plugin just add a symbolic link to that plugin.

For example we might be interested in some firewallgraphs of jiu-jitsu:

jiu-jitsu:~# cd /etc/munin/plugins/
ln -s /usr/share/munin/plugins/fw* .

And perhaps some graphs about munin itself.

jiu-jitsu:~# cd /etc/munin/plugins/
ln -s /usr/share/munin/plugins/munin* .

Restart munin-node:

jiu-jitsu:~#/etc/init.d/munin-node restart

We're Finished!

By default munin gathers information every 5 minutes.

Drink some coffee or tea and point your browser to http://aikido/munin/index.html, login with your username/password and if you did everything right you should see some nice graphs of aikido and jiu-jitsu.

Some plugins require additional configuration, read information supplied with the plugins.

Thats all.


This article can be found online at the Debian Administration website at the following bookmarkable URL:

This article is copyright 2008 martijnvanb - please ask for permission to republish or translate.