You are not logged in.

#1 2015-07-23 08:58:35

IlikePepsi
Member
Registered: 2013-10-29
Posts: 10

Fresh Munin install does not run. (Perl issue?)

I'm trying to use munin for machine monitoring and used pacman to install the official packages. The package version of munin and munin-node is 2.0.25-1. The node setup was quite easy and I use a systemd timer to collect data from my nodes with munin-cron. The munin-update.log is filled with output like:

2015/07/22 17:05:10 [INFO]: Starting munin-update
2015/07/22 17:05:10 [INFO] starting work in 19131 for local-machine/127.0.0.1:4949.
2015/07/22 17:05:10 [INFO] starting work in 19132 for remote-machine/remote-machine.localdomain:4949.
2015/07/22 17:05:10 [INFO] Reaping Munin::Master::UpdateWorker<local-machine;local-machine>.  Exit value/signal: 0/0
2015/07/22 17:05:10 [INFO] Reaping Munin::Master::UpdateWorker<remote-machine;remote-machine>.  Exit value/signal: 0/0
2015/07/22 17:05:10 [INFO]: Munin-update finished (0.03 sec)

The munin-master configuration was a little bit of a hassle, since I don't get along with apache very well. But I managed to define a virtual host that is actually loading the cgi scripts shipped with the munin packages. My Apache config:

/etc/httpd/conf/httpd.conf

...
#Added to enable fastcgi (package mod_fastcgi)
LoadModule fastcgi_module modules/mod_fastcgi.so 
...
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
...

/etc/httpd/conf/extra/httpd-vhosts.conf

...
# Munin vhost file
Include conf/extra/munin.conf
...

/etc/httpd/conf/extra/munin.conf

<VirtualHost *:80>
	ServerName munin.localdomain
	ServerAlias munin

	Alias /static /srv/http/munin/static
	Alias /munin /srv/http/munin

	<Directory "/srv/http/munin/static/">
		Options None
		Order allow,deny
		Require all granted
	</Directory>
	
	<IfModule !mod_rewrite.c>
		# required because we serve out of the cgi directory ands URLs are relative
		Alias /munin-cgi/munin-cgi-html/static /srv/http/munin/static
		RedirectMatch ^/$ /munin-cgi/munin-cgi-html/
	</IfModule>

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

        	# Static files
		RewriteRule ^/favicon.ico /srv/http/munin/static/favicon.ico [L]
		RewriteRule ^/static/(.*) /srv/http/munin/static/$1          [L]

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

	# Ensure we can run (fast)cgi scripts
	ScriptAlias /munin-cgi/munin-cgi-graph /usr/share/munin/cgi/munin-cgi-graph
	<Location /munin-cgi/munin-cgi-graph>
		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>
		Require all granted
		# Replace above with "Require all granted" if running apache 2.4
	</Location>

	ScriptAlias /munin-cgi/munin-cgi-html /usr/share/munin/cgi/munin-cgi-html
	<Location /munin-cgi/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>
		Require all granted
		# Replace above with "Require all granted" if running apache 2.4
	</Location>

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

	ErrorLog /var/log/httpd/munin-error.log
	CustomLog /var/log/httpd/munin-access.log combined
	
</VirtualHost>

After these preparations some permission issues persisted on some files when launching httpd but that could be fixed. Now I get the following output in the httpd error_log after starting httpd:

[Wed Jul 22 17:29:37.945965 2015] [lbmethod_heartbeat:notice] [pid 19701:tid 140226263656320] AH02282: No slotmem from mod_heartmonitor
[Wed Jul 22 17:29:37.946347 2015] [:notice] [pid 19702:tid 140226263656320] FastCGI: process manager initialized (pid 19702)
[Wed Jul 22 17:29:37.947030 2015] [mpm_event:notice] [pid 19701:tid 140226263656320] AH00489: Apache/2.4.16 (Unix) mod_fastcgi/mod_fastcgi-SNAP-0910052141 configured -- resuming normal operations
[Wed Jul 22 17:29:37.947051 2015] [core:notice] [pid 19701:tid 140226263656320] AH00094: Command line: '/usr/bin/httpd'

and the following after accessing the webpage:

[Wed Jul 22 17:30:55.114957 2015] [:warn] [pid 19702:tid 140226263656320] FastCGI: (dynamic) server "/usr/share/munin/cgi/munin-cgi-html" started (pid 19801)
[Wed Jul 22 17:30:55.625838 2015] [:warn] [pid 19702:tid 140226263656320] FastCGI: (dynamic) server "/usr/share/munin/cgi/munin-cgi-html" (pid 19801) terminated by calling exit with status '255'
[Wed Jul 22 17:31:00.626141 2015] [:warn] [pid 19702:tid 140226263656320] FastCGI: (dynamic) server "/usr/share/munin/cgi/munin-cgi-html" restarted (pid 19806)

Apparently the script fails but the log message from the munin-error log is a bit weird:

[Wed Jul 22 17:30:55.623231 2015] [:error] [pid 19707:tid 140226135353088] [client ::1:37200] FastCGI: server "/usr/share/munin/cgi/munin-cgi-html" stderr: [Wed Jul 22 17:30:55 2015] munin-cgi-html: HTML::Template::param() : attempt to set parameter 'groups' with a scalar - parameter is not a TMPL_VAR! at /usr/share/perl5/vendor_perl/Munin/Master/HTMLOld.pm line 695.

I've googled this error but most forum posts are quite some years old and the only bug report I found states that this behavior is a result of a hostname missmatch in the munin.conf when only one host is monitored. Since I got two hosts configured the bugfix doesn't apply. In the script on the reported line I found this code (it's the last line of the quoted section):

    $template->param(
                TAGLINE   => $htmltagline,
                GROUPS    => $groups,
                CSS_NAME  => get_css_name(),
		R_PATH => ".",
		ROOTGROUPS => $htmlconfig->{"groups"},
		MUNIN_VERSION => $Munin::Common::Defaults::MUNIN_VERSION,
		TIMESTAMP	=> $timestamp,
		NGLOBALCATS => $htmlconfig->{"nglobalcats"},
		GLOBALCATS => $htmlconfig->{"globalcats"},
		NCRITICAL => scalar(@{$htmlconfig->{"problems"}->{"criticals"}}),
		NWARNING => scalar(@{$htmlconfig->{"problems"}->{"warnings"}}),
		NUNKNOWN => scalar(@{$htmlconfig->{"problems"}->{"unknowns"}}),
					
    );

And above that piece of code is a comment stating the possibility of bugs with exactly the same error but without any hint how to fix it:

    # FIX: this sometimes bugs:

    # HTML::Template::param() : attempt to set parameter 'groups' with
    # a scalar - parameter is not a TMPL_VAR! at
    # /usr/local/share/perl/5.10.0/Munin/Master/HTMLOld.pm line 140

Now I would like to know:

- has anybody encountered that error on a fresh install of munin?

- is this a common issue? Are there known fixes?

- should I use a different system monitoring tool?

Thx in advance and sorry for long post.

Last edited by IlikePepsi (2015-07-23 08:59:32)

Offline

#2 2015-12-28 22:27:23

AIXMeister
Member
Registered: 2015-12-28
Posts: 1

Re: Fresh Munin install does not run. (Perl issue?)

Prerequisites
IlikePepsi wrote:

- has anybody encountered that error on a fresh install of munin?

You do a fresh installation of munin and munin-node and your /etc/munin/munin.conf contains the following parameters:

...
graph_strategy cgi
html_strategy cgi
...
Incorrect behaviour
IlikePepsi wrote:

- is this a common issue?

The HTML page, which is generated by /usr/share/munin/cgi/munin-cgi-html, shows the alternating behavior on every reload:

  1. The page loads and displays normally

  2. The page does not load. Instead this error is shown:

    HTML::Template::param() : attempt to set parameter 'groups' with a scalar - parameter is not a TMPL_VAR! at /usr/share/perl5/vendor_perl/Munin/Master/HTMLOld.pm line 695.
Workaround
IlikePepsi wrote:

- Are there known fixes?

Edit /usr/share/munin/cgi/munin-cgi-html on line 55 and change the parameter for get_config from one to zero:

$config = get_config(0);

I opened an issue to the munin developers.

Offline

Board footer

Powered by FluxBB