I cannot get the Munin dynamic zoom to work. I am rather certain that the problem has something to do with the Nginx configuration. Any attempt to generate a zoomed graph triggers the following error entry in the nginx log:
2015/02/22 13:26:01 [error] 4782#0: *2580 open() "/data/munin/usr/share/munin/cgi/munin-cgi-graph/bellaria/antergos1.bellaria/diskstats_latency/AntergosVG_AntergosRoot-pinpoint=1421756527,1424607727.png" failed (2: No such file or directory), client: 10.10.10.25, server: munin, request: "GET /usr/share/munin/cgi/munin-cgi-graph/bellaria/antergos1.bellaria/diskstats_latency/AntergosVG_AntergosRoot-pinpoint=1421756527,1424607727.png?&lower_limit=&upper_limit=&size_x=800&size_y=400 HTTP/1.1", host: "munin.bellaria", referrer: "http://munin.bellaria/static/dynazoom.html?cgiurl_graph=/usr/share/munin/cgi/munin-cgi-graph&plugin_name=bellaria/antergos1.bellaria/diskstats_latency/AntergosVG_AntergosRoot&size_x=800&size_y=400&start_epoch=1421756527&stop_epoch=1424607727"
Specifically, I suspect that something is wrong with the fastCGI parameters. May a good friendly soul take a look at my Munin virtual server (see below) and explain to me what's wrong? It's driving me crazy - yet I have a hunch that any expert will identify the problem in a fraction of a second...
# Munin server
server {
listen 80;
server_name munin munin.bellaria;
root /data/munin;
allow all;
access_log logs/munin.access.log;
error_log logs/munin.error.log;
location / {
index index.html index.htm index.php;
}
location ~ \.(php|html|html|cgi)$ {
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi.conf;
}
location ^~ /cgi-bin/munin-cgi-graph/ {
access_log off;
fastcgi_split_path_info ^(/cgi-bin/munin-cgi-graph)(.*);
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/var/run/munin/fcgi-graph.sock;
include fastcgi_params;
}
}
I found this while looking for a solution to my problem and good news! I solved my problem. I hope this will help you get munin working on your setup too.
Requirements:
Install the above under
/etc/init.d/munin-fcgi
with permissions755
/etc/nginx/conf.d/example.com.conf
, add this in theserver { }
block. You can change the ip blocks allowed to fit your setup. I did this on a local server and wanted the munin graphs to be available only locally./etc/init.d/munin-fcgi start
and reload nginx then you are good to go.p.s I did link munin's html folder to my vhost's folder:
ln -s /var/cache/munin/www/ /var/www/example.com/munin -v
.This sounds like a problem with the definitions in
static/dynazoom.html
. In our installation we haveI suspect you have
Whilst it should be
I'm still convinced this is roughly where the problem lies. The nginx config looks correct as long as requests for zoomed graphs start with
/cgi-bin/munin-cgi-graph
. I don't see where/data/munin/...
is coming from.Try running in an environment where you can monitor the requests being sent by the browser (fiddler, chrome dev tools) and see what is really being sent.
Are you sure you're editing the right copy of dynazoom? Try making a trivial visible change just to verify this.
I had similar problem on ubuntu 12.04 with munin 2.0.21.
Check where dynazoom is trying to find munin-cgi-graph.
Munin's wiki says that you should configure your nginx fcgi-graph for
In my case when i examine page with Chrome developer tool (Network tab) i found that dynazoom trying to fetch munin-cgi-graph from /munin-cgi/munin-cgi-graph/ not from /cgi-bin/munin-cgi-graph/ and it gets 404 erorr instead of graph
So i just changed this location in nginx config:
Looks like you have the same problem your munin-cgi-graph location is incorrect so browser requests go to
root /data/munin
just as error says.Something I wanted to add to this conversation. The information from the_architecht was pretty invaluable, but something that was missing at least for me.
Using CentOS 6.8 here:
-
1) Paths for the CGI files changed, those can be found via locate:
I had to go line by line in the start script to compare locations and break out the daemon start lines to see what was wrong which let me track down the file path differences.
-
2) Permissions for the logs were set to the "munin" user which caused a silent error of sorts. To solve this I added www-data user to the munin group and chmod 664 the log files:
The give away for the file permissions involved the Munin wiki adding the -n at the end of the spawn-fcgi process start and strace -s1024 which gave error
My final Nginx and spawn-fcgi is below with my modifications: