Munin 2.0 on Debian

Munin 2.0 has been released and packaged for Debian, and even backported to Squeeze (from backports.debian.org). Even though there are still some quirks in this version (or just the Debian packaging), it is far better (more scalable, more powerful and prettier) than version 1.4. Basically, the following article should cover it all: http://munin-monitoring.org/wiki/CgiHowto2, but doesn't quite achieve it, so far. Let's see together how to install it successfully on Debian Squeeze. I will however not cover the agent (Munin Node), as there is no significant difference between basic installation of its 1.4 and 2.0 versions. As a first significant performance improvement, Munin is now able to use RRDcached (it fairly reduces the disk I/O pressure on RRD files), and it is fairly easy to setup. Just install package rrdcached (who would have guessed?), then add the following options to OPTS in /etc/default/rrdcached:

OPTS="-s munin -l unix:/var/run/rrdcached.sock -b /var/lib/munin/ -B -j /var/lib/munin/journal/ -F"

This will override its defaults. And of course, restart then the daemon. Adapt /etc/munin/apache.conf to your likings, in this case, we are going to uncomment all cgi and fastcgi-related blocks. Install packages libapache2-mod-fcgid and spawn-fcgi, then download the following script and install it as an initscript on your system (e.g. as /etc/init.d/spaw-fcgi-munin-graph and running insserv): http://files.julienschmidt.com/public/cfg/munin/spawn-fcgi-munin-graph (though this version is still buggy and quite fragile, contact me for a slightly improved version)

apt-get install libapache2-mod-fcgid spawn-fcgi

Add user munin and www-data to group adm, and allow group adm to write to /var/log/munin/munin*-cgi-*.log:

adduser munin adm
adduser www-data adm
chmod g+w /var/log/munin/munin*-cgi-*.log

Add user www-data to group munin and the opposite:

adduser www-data munin; adduser munin www-data

Start the spawn-fcgi-munin-graph service and check it is indeed running. Enable the fcgid and rewrite Apache modules and restart the Apache2 service. Customize /etc/munin/munin.conf to your likings, enabling the (Fast)CGI parts. Whenever monitoring more than a single host, I recommend moving (i.e. commenting and copying) the localhost definition to some new /etc/munin/munin-conf.d/ file per domain (e.g. beeznest.conf), and add your hosts there, with a meaningful domain name.

Comments

Hi,

Thank you for this tutorial. I tried to use your init script on a small arm-based debian squeeze server and get an error when starting it by hand. The -U flag (in -U www-data) is unknown for spawn-cgi 1.4.19. It seems not related to user or group (since the -u and -g flags are alos used in your script with munin user and group). How should I change this script?

Hi,

I followed your tips on an Ubuntu 12.04 server (installed Munin v2.0.2), but the only problem I have is that if I change html_strategy to cgi my html don't get generated anymore. graph_strategy cgi works fine, the munin-cgi-graph.log shows graph generation etc.
Only thing is that to be able to see those graphs, I need to change html_strategy back to cron and wait till the cron runs.

Any idea what I might be doing wrong here? I'm guessing that since graph_strategy cgi works, I've probably done all the Apache/FCGI configuration correctly, so maybe it's a permissions issue? Can't seem to find any errors in the logs in order to help me pinpoint the cause...

It is pretty tricky to get right, and some (most?) versions of Munin 2.0.x are known to be buggy with CGI.