Adding Apache Reporting To Munin

When you first install a Munin node it will try to install as many plugins as it can so that it can report on different things. For example, if you have a Varnish server running then Munin will detect this and enable the plugins so that it can report on the activity of Varnish. Once you have started getting data through to your Munin server then you can turn on plugins on the nodes to get more data.

The data of any plugin is presented in a standard format and so is understood by the Munin server. Perhaps the most important plugin for my work is the Apache status plugin that shows what is going on inside Apache. This plugin isn't always installed with the Munin node and so you might have to do this yourself. This is a good way of getting familiar with Munin plugins.

To install a Munin plugin you just need to link it from the directory /usr/share/munin/plugins/ to /etc/munin/plugins/. If you look at the contents of the first directory you will see a lot of different plugins available, some of which will already be linked from the second directory. You can run the following command to install the Apache plugins. Once the Munin plugin is linked you need to restart the Munin node to pick up the plugin.

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

You might find that the Apache plugins are aready linked. If this is the case then it will probably be because Munin can't see the Apache reports. You'll need to enable the Server Status Apache mod in order to allow Munin to report on Apache statistics. The first thing to do is turn on the ExtendedStatus setting in the Apache configuration file. If you are on Ubuntu then the file you need is located at /etc/apache2/mods-available/status.conf. This setting might also live in the file sudo vi /etc/http/conf/httpd.conf if you are on Centos. You need to change the ExtendedStatus flag to be On, which usually means just uncommenting the line in question.

ExtendedStatus On

Once this is done you need to allow access to the /server-status address from the server itself. This page reports on various statistics from the Apache server, including the number of requests being made and the number of Apache workers currently active. This page is used by the Munin Apache plugins to gain information about the Apache server. Because of the sensitive nature of this data it's best to block access from anyone but requests from the localhost. Adding the following clause into your Apache server config will do this. If you are on Ubuntu then this is already defined.

<IfModule mod_status.c>

ExtendedStatus On
<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from localhost ip6-localhost
</Location>

</IfModule>

Once you have made these changes you need to restart Apache for them to be loaded. With this in place on your Munin node you will now start seeing Apache statistics being generated in your Munin graph data.

Comments

is it possible to monitor HTTPS?
Permalink

Add new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
1 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.