Monday, August 9, 2010

Enabling apache_* Munin plug-ins in Ubuntu

munin-apache-150

There are three Munin plug-ins for Apache monitoring bundled with Ubuntu's munin-node package:

  • apache_accesses - monitors the number of accesses to Apache servers
  • apache_processes - monitors the number of apache-processes running on the machine, and (in addition to a simple process count), separate then into "busy" or "idle" servers
  • apache_volume - monitors the volume of data sent from Apache servers

First of all, make sure that the libwww-perl package is installed on your system, or you might notice an error like this when you're executing these plug-ins directly from /usr/share/munin/plugins:

Can't locate object method "new" via package "LWP::UserAgent" at ./apache_volume line 127

In addition, apache_accesses and apache_volume require ExtendedStatus support to be enabled as well as mod_status module.

Status module can be enabled by running:

$ sudo a2enmod status
$ sudo /etc/init.d/apache2 restart

To enable ExtendedStatus support create a /etc/apache2/conf.d/extendedstatus file containing the following directives:

<IfModule mod_status.c>
   ExtendedStatus On
</IfModule>

Now create symbolic links to plug-ins in /etc/munin/plugins directory:

$ cd /etc/munin/plugins
$ sudo ln -s /usr/share/munin/plugins/apache_accesses
$ sudo ln -s /usr/share/munin/plugins/apache_processes
$ sudo ln -s /usr/share/munin/plugins/apache_volume

Reload Apache and restart munin-node:

$ sudo /etc/init.d/apache2 reload
$ sudo /etc/init.d/munin-node restart