Table of Contents

Munin

munin: is a graphing tool that uses rrdtool. It has a lot of Apache plugins (including two for Passenger!). See list.

Here's a guide on how to install and configure plugins.

Restart your node after you've installed or configured a plugin:

/etc/init.d/munin-node restart

Please note that it may take up to five minutes before your plugin shows up in your munin website (apparently, munin polls only every 5 minutes).

Installation & Configuration

I had no trouble installing Munin through apt-get on Ubuntu 6.06. You have to install two packages:

apt-get install munin
apt-get install munin-node

The node gathers data, the 'monitor' plots it.

Note, added 20140908: I did have some dependency problems while installing munin-node on Ubuntu 8.04. In the end, I solved these by downloading and installing each of the required .deb packages (a number of Perl libraries or modules, one of which is libwww-perl to get Apache monitoring all set).

If you run into any further trouble with Apache monitoring, see Enabling munin node plug-ins on Ubuntu

Website

The monitoring graphs are displayed on a website. By default, munin places the website scripts in /var/www/munin. I have created an Apache virtual host which symlinks to this location:

ln -s /var/www/munin public_html
# public_html -> /var/www/munin

And for a later version of munin, under Debian 6.0.5:

 ln -s /var/cache/munin/www /home/muninstats/public_html

Don't forget to restrict access to this website through e.g. .htpasswd.

Plugins

The default plugins are in /usr/share/munin/plugins/. They appear in your munin website if they're symlinked in /etc/munin/plugins. You must also configure them in the file /etc/munin/plugin-conf.d/munin-node.

Plugin configuration

If you want to configure multiple plugins at once, use an asterisk notation. E.g.:

[apache*]

This addresses all apache plugins, which are by default:

apache_accesses
apache_processes 
apache_volume

Usually when you look at the source code of the plugins (they're mostly perl scripts), you will find configuration instructions. For instance, the apache plugins need access to Apache's server status, so you have to configure Apache (i.e. httpd.conf):

<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
</Location>
ExtendedStatus on

I should also mention that some plugins seem to exclude each other. For instance, the apache_average_time_last_n_requests plugin (not installed by default) seems to exclude the other (default) apache plugins.

Adding a New Server for Monitoring

This comes down to:

  1. installing munin-node on the new server (don't forget to configure the plugins for this munin node)
  2. adding the new server's ip-address to /etc/munin/munin.conf (on the munin server)

You should also make sure that the new server's firewall is configured for telnet (port 4949).

1. Installing munin-node

apt-get install munin-node

Add the ip address of the Munin server (i.e. the “master”) to /etc/munin/munin-node.conf:

  allow ^xxx\.xxx\.xxx\.xxx$

(Yes, you have to use the regexp format)

Now go to /etc/munin/plugins, add symlinks to the apache plugins:

ln -s /usr/share/munin/plugins/apache_accesses .
ln -s /usr/share/munin/plugins/apache_processes .
ln -s /usr/share/munin/plugins/apache_volume .

Add the plugins to the list in /etc/munin/plugin-conf.d/munin-node:

[apache*]

Restart the munin node:

/etc/init.d/munin-node restart

Remember to open the firewall for port 4949 (Telnet)!

Apache Plugins

Apache plugins use Apache's mod_status to retrieve information. So, make sure that you've got mod_status installed (which it is by default under Ubuntu), and configured in /etc/apache2/apache2.conf:

<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
</Location>

ExtendedStatus on

Don't forget to restart Apache. You can test the server-status call using wget:

wget http://localhost/server-status
--21:33:13--  http://localhost/server-status
           => `server-status'
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2.811 (2.7K) [text/html]

100%[===================================================================================================================================================================>] 2.811         --.--K/s             

21:33:13 (65.38 MB/s) - `server-status' saved [2811/2811]

You should get a 200 OK response. (You might want to delete the new file 'server-status' afterwards).

2. Configure Munin Server

Add the ip address of the node server to the file /etc/munin/munin.conf:

[ArbitraryServerName] # Apparently, you can't use spaces in this name
    address xxx.xxx.xxx.xxx
    use_node_name yes

The Munin server (the 'master') will read the new values within 5 minutes (the default polling interval).