Setup Webserver Monitoring with Munin

The tool Munin offers an easy way to monitor a webserver. It comes along with a lot of features like monitoring disk and memory usage, the CPU, the fork rate of new processes and much more. The monitored data is accessible by the web browser. The setup of Munin takes only a few minutes.

First you have to install Munin. In Fedora Linux this can be done via YUM:

[sourcecode language=”bash”]
yum install munin munin-node

Once installed you have to edit the configuration file /etc/munin/munin.conf (The default file contains a lot of comments). For a basic setup you can add the following lines:

[sourcecode language=”text”]

dbdir /var/lib/munin
htmldir /var/www/html/munin
logdir /var/log/munin
rundir /var/run/munin

use_node_name yes


In this case “/var/www/html/” has to be the HTML directory of you webserver. What is missing now is to create the HTML directory for Munin and set the correct permissions:

[sourcecode language=”bash”]
mkdir -p /var/www/html/munin
chown munin:munin /var/www/html/munin

Restart Munin

[sourcecode language=”bash”]
/etc/init.d/munin-node restart

The monitoring is running now. The results can be accessed by the webbrowser:

By default there is a .htaccess password protection for this page activated. You can either remove the file /var/www/html/munin/.htaccess or create a username password combination like follows:

You can create the required password file (usually /etc/munin/munin-htpasswd, it is quoted in the .htaccess file) like follows

[sourcecode language=”bash”]
htpasswd -c /etc/munin/munin-htpasswd Admin

Where Admin is the username. You will be asked for the password in a prompt.

Munin produces intuitive graphs of the monitored resources like the following one:

Leave a Reply

Your email address will not be published. Required fields are marked *