# Munin issue



## Leander (Mar 4, 2013)

Hi fellows,

I set up Munin according to this how to http://munin-monitoring.org/wiki/CgiHowto2. It partial*l*y works. The main site loads proper as well as I can click two levels into the graphs - but unfortunately I can't get the dynamic zoom feature working.


```
cat httpd-error.log
[Mon Mar 04 21:14:04 2013] [error] [client 10.0.10.10] File does not exist: /usr/local/www/Munin.MyDomain.Local/sites/MyDomain.Local, referer: http://munin.MyDomain.Local/MyDomain.Local/Storage-10.MyDomain.Local/static/dynazoom.html?MyDomain.Local=/cgi-bin/munin-cgi-graph&plugin_name=MyDomain.Local/Storage-10.MyDomain.Local/iostat&size_x=800&size_y=400&start_epoch=1362319810&stop_epoch=1362427810
```
It seems like it's looking for this:
cgitmpdir /usr/local/www/Munin.MyDomain.Local/tmp/munin

```
ls -lach /usr/local/www/Munin.MyDomain.Local/tmp/munin/munin-cgi-graph/
total 12
drwxr-xr-x  3 admin  admin   512B  4 MÃ¤r 02:37 .
drwxrwxrwx  3 admin  admin   512B  4 MÃ¤r 02:38 ..
drwxr-xr-x  3 admin  admin   512B  4 MÃ¤r 02:37 MyDomain.Local
```

But it's not redirecting into it ;/

Changes I made in the munin.conf:

```
htmldir /usr/local/www/Munin.MyDomain.Local/sites/Munin
html_strategy cgi
graph_strategy cgi
cgitmpdir /usr/local/www/MyDomain.Local/tmp/munin
cgiurl_graph /cgi-bin/munin-cgi-graph
logdir /usr/local/www/MyDomain.Local/logs/munin
log_file /usr/local/www/MyDomain.Local/logs/munin/munin-node.log
```

I modified the following lines of the given httpd-vhosts.conf:

```
<VirtualHost *:80>
[...]
Alias /cgi-bin/munin-cgi-html/static /usr/local/www/MyDomain.Local/sites/Munin/static
RedirectMatch ^/$ /cgi-bin/munin-cgi-html/
[...]
RewriteRule ^/favicon.ico /usr/local/www/MyDomain.Local/sites/Munin/static/favicon.ico [L]
RewriteRule ^/static/(.*) /usr/local/www/MyDomain.Local/sites/Munin/static/$1          [L]
[...]
RewriteRule ^(/.*\.html)?$           /cgi-bin/munin-cgi-html/$1 [PT]
[...]
RewriteRule ^/cgi-bin/munin-cgi-graph/(.*) /$1
[...]
RewriteRule ^/(.*.png)$  /cgi-bin/munin-cgi-graph/$1 [L,PT]
[...]
ScriptAlias /cgi-bin/munin-cgi-graph "/usr/local/www/MyDomain.Local/cgi-bin/munin-cgi-graph"
<Location /cgi-bin/munin-cgi-graph>
[...]
ScriptAlias /cgi-bin/munin-cgi-html "/usr/local/www/MyDomain.Local/cgi-bin/munin-cgi-html"
<Location /cgi-bin/munin-cgi-html>
[...]
<Location /cgi-bin/munin-cgi-html/static>
[...]
</VirtualHost>
```

I'm totally lost - can't find my blunder ;/ Any ideas?


----------



## SirDice (Mar 5, 2013)

Leander said:
			
		

> ```
> cgitmpdir /usr/local/www/MyDomain.Localtmp/munin
> ```


Looks like it's missing a slash here.


```
cgitmpdir /usr/local/www/MyDomain.Local[B]/[/B]tmp/munin
```


----------



## Leander (Mar 5, 2013)

SirDice said:
			
		

> Looks like it's missing a slash here.
> 
> ```
> cgitmpdir /usr/local/www/MyDomain.Local[B]/[/B]tmp/munin
> ```



Thanks for the hint. This must have accidently happened when I prepared this post - I fixed it in the initial post - sorry about that.
Any other idea?

Best Regards
L


----------



## Leander (Mar 15, 2013)

To me it seems like it is a pure redirection issue in vHost config. Apache logs the following error:

```
File does not exist: /usr/local/www/Munin.MyDomain.Local/sites/MyDomain.Local, referer: http://munin.MyDomain.Local/MyDomain.Local/
```

The files it is looking for are actually lieing in here:
/usr/local/www/Munin.MyDomain.Local/tmp/munin/munin-cgi-graph/MyDomain.Local



And this is the relevant vHost configuration part:

```
<IfModule mod_rewrite.c>
    # Rewrite rules to serve traffic from the root instead of /cgi-bin
    RewriteEngine On

    # Static files
    RewriteRule ^/favicon.ico /usr/local/www/Munin.MyDomain.Local/sites/Munin/static/favicon.ico [L]
    RewriteRule ^/static/(.*) /usr/local/www/Munin.MyDomain.Local/sites/Munin/static/$1          [L]

    # HTML
    RewriteRule ^(/.*\.html)?$           /cgi-bin/munin-cgi-html/$1 [PT]

    # Images
    RewriteRule ^/cgi-bin/munin-cgi-graph/(.*) /$1
    RewriteCond %{REQUEST_URI}                 !^/static
    RewriteRule ^/(.*.png)$  /cgi-bin/munin-cgi-graph/$1 [L,PT]
</IfModule>

# Ensure we can run (fast)cgi scripts
ScriptAlias /cgi-bin/munin-cgi-graph /usr/local/www/Munin.MyDomain.Local/cgi-bin/munin-cgi-graph
ScriptAlias /cgi-bin/munin-cgi-html /usr/local/www/Munin.MyDomain.Local/cgi-bin/munin-cgi-html

<Location ~ "/cgi-bin/(munin-cgi-graph|munin-cgi-html)">
    Options +ExecCGI
    <IfModule mod_fcgid.c>
        SetHandler fcgid-script
    </IfModule>
    <IfModule mod_fastcgi.c>
        SetHandler fastcgi-script
    </IfModule>
    <IfModule !mod_fastcgi.c>
        <IfModule !mod_fcgid.c>
            SetHandler cgi-script
        </IfModule>
    </IfModule>
    Allow from all
</Location>

<IfModule !mod_rewrite.c>
    <Location /cgi-bin/munin-cgi-html/static>
            # this needs to be at the end to override the above sethandler directives
            Options -ExecCGI
            SetHandler None
    </Location>
</IfModule>
```


I'm still stuck in here ;(
I could use some hints 

Thanks


----------



## kevpatts (Jul 15, 2013)

I'm having exactly the same problem in Ubuntu, can't find any other report of it except for here. Did you get this resolved?


----------



## kevpatts (Jul 15, 2013)

Looking further into this it looks like pinpoint processing has been broken since the 2.0-alpha2 release:

```
BUG: Broke --pinpoint processing
```
http://munin-monitoring.org/browser/munin/ChangeLog#L879


----------



## Leander (Jul 16, 2013)

kevpatts said:
			
		

> Looking further into this it looks like pinpoint processing has been broken since the 2.0-alpha2 release:
> 
> ```
> BUG: Broke --pinpoint processing
> ...



Thx Thanks - at least I know now that it's not my bad  Any idea in which release this may be fixed?


----------



## kevpatts (Jul 16, 2013)

No, but it's been broken for 2.5 years so I doubt it will be fixed any time soon.


----------



## Leander (Jul 24, 2013)

Hi there

I found the solution. The issue only occurs in combination with fastCGI. Using regular CGI instead results in a perfectly working Munin web interface. For myself, I reduced the suggested vHost configuration of Munin CgiHowto2 to the following (Apache 2.4 compatible):

Most important in order to let graphing work proper is the line:

```
SetHandler      cgi-script
```
Make sure there is no 
	
	



```
SetHandler fastcgi-script
```
 or 
	
	



```
SetHandler fcgid-script
```
 in the part of the Apache configuration which is responsible for serving Munin.


```
<IfModule mod_rewrite.c>
    # Rewrite rules to serve traffic from the root instead of /cgi-bin
    RewriteEngine On

    # Static files
    RewriteRule ^/favicon.ico /usr/local/www/Munin.FreeBSD.Local/sites/Munin/static/favicon.ico [L]
    RewriteRule ^/static/(.*) /usr/local/www/Munin.FreeBSD.Local/sites/Munin/static/$1          [L]

    # Default to HTML
    RewriteRule ^(/.*\.html)?$           /cgi-bin/munin-cgi-html/$1 [PT]

    # Images
    RewriteRule ^/cgi-bin/munin-cgi-graph/(.*) /$1
    RewriteCond %{REQUEST_URI}                 !^/static
    RewriteRule ^/(.*.png)$  /cgi-bin/munin-cgi-graph/$1 [L,PT]
</IfModule>

# Ensure we can run CGI scripts
<Location ~ "/cgi-bin/(munin-cgi-graph|munin-cgi-html)">
    Options         +ExecCGI
    SetHandler      cgi-script
    AllowOverride   None
    Require         all granted
</Location>
```

Nevertheless, I still need this stupid cronjob to run periodically in order to create a proper static HTML environment. Otherwise the Munin CGI script fails and displays HTTP ERROR 500. I originally was hoping to get rid of this cronjob by using a CGI strategy.

Anyway - let me know wheter you had luck and where able to solve your issue the same way.
Best regards


----------



## freebuser (Jul 24, 2013)

Not sure whether this helps these are my settings using nginx.

I removed the crontab entry after FastCGI configuration.

nginx virtual server:

```
server {
                listen 80;
                server_name  status.escix.com;
                client_max_body_size 2M;
                root /usr/local/www;
location / {
        rewrite ^/$ munin/ redirect; break;
}

location ^~ /munin-cgi/munin-cgi-graph/ {
    fastcgi_split_path_info ^(/munin-cgi/munin-cgi-graph)(.*);
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_pass unix:/var/run/munin/fastcgi-graph.sock;
    include fastcgi_params;
}

location /munin/static/ {
    alias /usr/local/www/munin/static/;
}

location /munin/ {
    fastcgi_split_path_info ^(/munin)(.*);
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_pass unix:/var/run/munin/fastcgi-html.sock;
    include fastcgi_params;
}

               }
```

munin.conf

```
# Graphics files are generated either via cron or by a CGI process.
# See http://munin-monitoring.org/wiki/CgiHowto2 for more
# documentation.
# Since 2.0, munin-graph has been rewritten to use the cgi code.
# It is single threaded *by design* now.
#
graph_strategy cgi

# munin-cgi-graph is invoked by the web server up to very many times at the
# same time.  This is not optimal since it results in high CPU and memory
# consumption to the degree that the system can thrash.  Again the default is
# 6.  Most likely the optimal number for max_cgi_graph_jobs is the same as
# max_graph_jobs.
#
munin_cgi_graph_jobs 6
```


----------



## kevpatts (Jul 24, 2013)

Thanks @Leander,

But my install is a generic install in Ubuntu from repositories. No FastCGI or fcgid in use at all.

Kevpatts


----------

