Setting up Apache monitoring with Munin
07 October 2009 | Matt Perdeaux | Backend, Sysadmin
After a few solid days of Linux server wrangling, I found getting Munin to monitor our Apache server more hassle than I thought it would be.
Salient system details:
- Ubuntu Hardy
- Nginx web server (port 80) proxy
- Apache web server (port 8080)
So, if only for my own future reference, here's how I managed it:
- Make sure the WWW Protocol library for Perl is installed:
sudo apt-get install libwww-perl - Apache needs to be running mod_status (which serves of the stats that Munin draws charts for). Add the following somewhere in /etc/apache2/apache2.conf:
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location> - Restart Apache:
sudo /etc/init.d/apache2 restart - The Munin plugins actually live in /usr/share/munin/plugins, and are symlinked to in /etc/munin/plugins:
sudo ln -s /usr/share/munin/plugins/apache_accesses /etc/munin/plugins/apache_accesses
sudo ln -s /usr/share/munin/plugins/apache_activity /etc/munin/plugins/apache_activity
sudo ln -s /usr/share/munin/plugins/apache_processes /etc/munin/plugins/apache_processes
sudo ln -s /usr/share/munin/plugins/apache_volume /etc/munin/plugins/apache_volume
NB - If you have uploaded any additional plugins, ensure root has execute permission:sudo chmod 755 apache_activity - Make sure the Munin plugins are monitoring port 8080 - in this setup I've got Nginx on the default port. Add the following to /etc/munin/plugin-conf.d/munin-node:
[apache_*]
env.ports 8080 - Restart the Munin node:
sudo /etc/init.d/munin-node restart