We use munin a lot. Consequently munin-graph takes up more than 5 minutes every time, breaking munin-cron, and loosing data. Since we graph a lot more data than we normally look at, because most of it only matters when we’re planning something or when something breaks, we don’t need new graphs every five minutes. So I switched munin-graph to use munin-cgi-graph. The basic instructions are in the munin CgiHowto. It’s pretty easy.
But each node page has a lot of graphs, so it’s annoying to wait for them all to get created. FastCGI helps, so I went about setting that up too.
First, package ‘libapache2-mod-fastcgi’ is in non-free, so you may not find it. I started using ‘libapache2-mod-fcgid’ for a bit, but since I was having trouble, downloaded the fastcgi package from non-free and added it to the local repository. munin-cgi-graph is in /usr/lib/cgi-bin on debian so I added this to my apache config:
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory /usr/lib/cgi-bin/>
AllowOverride None
SetHandler fastcgi-script
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
<Location /cgi-bin/munin-cgi-graph>
SetHandler fastcgi-script
</Location>
I had munin-cgi-graph working if I removed the SetHandler line, but when I left it, I’d get a lot of errors and no graphs like:
FastCGI: incomplete headers (0 bytes) received from server
[error] [client 10.0.0.60] Premature end of script headers: munin-cgi-graph
Warning: Request for graph without specifying domain. Bailing out.
I had to apply a diff to mod-cgi-graph for fastcgi support. For whatever reason I skipped this, perhaps assuming it had gotten into the deb already. Download the diff to your home directory then apply it.
cd /usr/lib/cgi-bin/
cp munin-cgi-graph munin-cgi-graph.in
patch -p0 munin-cgi-graph.in ~/munin-cgi-graph_fastcgi.diff
mv munin-cgi-graph munin-cgi-graph.orig
cp munin-cgi-graph.in munin-cgi-graph
Hi,
thank you for your post. I am getting the following error on patching the munin-cgi-graph file:
patch: **** Only garbage was found in the patch input
This normally means that the diff file is corrupted or something else.
Did somebody experience the same problem ?
Thank You
@Reti,
Take a look at the patch file. You’ll need to be sure you’re saving the raw output with no HTML from that page. It should start like this:
If it doesn’t, you’ll want to make sure you’re downloading the diff like:
@btm
Thank You that was the problem. The diff file was in a html format 🙂
But now I get on my nagios “website” = Invalid parameters! when i try to open http://www.mydomain.com/cgi-bin/munin-cgi-graph and in the apache2 error logs I get:
Use of uninitialized value in split at /usr/lib/cgi-bin/munin-cgi-graph line 77.
Warning: Request for graph without specifying domain. Bailing out.
I also tried to remove the “SetHandler” line but without success 🙁
It is Debian 4.0 Etch System.
Perhaps you also know how to handle that 😀
@Reti,
Sorry, I just saw that error before I patched munin-cgi-graph. Perhaps ensure that the version of munin-cgi-graph in /usr/lib/cgi-bin is indeed the version that you’ve patched.
It looks like around line 80 of the patched munin-cgi-graph is where you would get that error if you’re not passing all the data.
Are your image links something like:
https://munin/cgi-bin/munin-cgi-graph/prod.example.org/server.prod.example.org/apache_processes-day.png ?
More specifically, did you add ‘graph_strategy cgi’ to your munin.conf and has munin-html rerun to update all of the links as discussed in step #2 of the cgi howto?
Pingback: Replacing munin with ganglia at btm.geek
Pingback: munin-cgi-graph with fcgid on ubuntu lucid « btm.geek