Bug 861816 - munin-2.x CGI support is broken without manual hacks
munin-2.x CGI support is broken without manual hacks
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: munin (Show other bugs)
16
All Linux
unspecified Severity medium
: ---
: ---
Assigned To: Kevin Fenzi
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-30 18:41 EDT by Lonni J Friedman
Modified: 2013-01-11 18:15 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-12-17 21:31:13 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Lonni J Friedman 2012-09-30 18:41:12 EDT
Description of problem:
The recently released munin-2.x updates do not work "out of the box" without a number of ugly hacks.

Version-Release number of selected component (if applicable):
2.0.6-2

Additional details:
munin-2.x advertises itself as have real, mature cgi support ( http://munin-monitoring.org/wiki/CgiHowto2 ) for generating all the web content (HTML+images).  Unfortunately, the recently released 2.x munin RPM flat out doesn't work to support any cgi driven content generation without a number of hacks.  I've gotten this working after making the following changes:

yum install mod_fcgid spawn-fcgi  # perhaps this needs to be a dependency for the munin-2.x RPMs ?
systemctl start munin-fcgi-graph.service munin-fcgi-html.service # this seems like a documentation issue, as I'm not sure how anyone would ever know that these services even exist
chgrp apache /var/log/httpd/munin/munin-cgi-* && chmod g+w /var/log/httpd/munin/munin-cgi-* # tons of permission denied errors in the apache error log for every munin web content page load until I fixed this
mkdir -p /var/lib/munin/cgi-tmp/munin-cgi-graph && chown -R munin.apache /var/lib/munin/cgi-tmp && chmod -R 
u+g /var/lib/munin/cgi-tmp  # tons of "Unable to graph ..." random png file errors in the /var/log/munin/munin-cg-graph.log

* add to munin.conf: # shouldn't these at least be commented out in the default file, so that people know they exist?
html_strategy cgi
cgiurl_graph /munin/cgi/munin-cgi-html

* add to /etc/httpd/conf/httpd.conf  #perhaps there's a way to get this working inside of /etc/httpd/conf.d/munin.conf but I couldn't, and ran out of patience
RewriteEngine On
ScriptAlias /munin/cgi/munin-cgi-graph /var/www/html/munin/cgi/munin-cgi-graph
<Location /munin-cgi/munin-cgi-graph>
        Options +ExecCGI
        SetHandler fcgi-script
</Location>
ScriptAlias /munin/cgi/munin-cgi-html /var/www/html/munin/cgi/munin-cgi-html
<Location /munin-cgi/munin-cgi-html>
        Options +ExecCGI
        SetHandler fcgi-script
</Location>



Perhaps I'm doing something wrong somewhere, but I couldn't locate any useful, accurate documentation anywhere that was specific to Fedora.
Comment 1 Fedora Update System 2012-11-04 12:14:41 EST
munin-2.0.7-5.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/munin-2.0.7-5.fc18
Comment 2 Fedora Update System 2012-11-04 12:17:36 EST
munin-2.0.7-5.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/munin-2.0.7-5.fc17
Comment 3 Fedora Update System 2012-11-04 12:18:39 EST
munin-2.0.7-5.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/munin-2.0.7-5.fc16
Comment 4 Fedora Update System 2012-11-04 12:19:44 EST
munin-2.0.7-5.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/munin-2.0.7-5.el6
Comment 5 Fedora Update System 2012-11-04 12:21:50 EST
munin-2.0.7-5.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/munin-2.0.7-5.el5
Comment 6 Lonni J Friedman 2012-11-04 12:34:02 EST
I'm pleased to see this bug getting attention.  The new munin-cgi RPM references http://munin-monitoring.org/wiki/CgiHowto2 but that page doesn't have any fedora specific information.  Can you comment (either here or the wiki) on what needs to be done after installing these RPMs to get cgi generated content working correctly?

thanks!
Comment 7 Fedora Update System 2012-11-04 14:19:55 EST
Package munin-2.0.7-5.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing munin-2.0.7-5.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-17591/munin-2.0.7-5.fc18
then log in and leave karma (feedback).
Comment 8 Lonni J Friedman 2012-11-04 15:24:15 EST
I installed all the 2.0.7-5 RPMs and I'm trying to get CGI working, and still no love:

# systemctl start munin-fcgi-graph.service
Job failed. See system logs and 'systemctl status' for details.
# tail /var/log/messages
Nov  4 11:58:43 hal systemd[1]: Reloading.
Nov  4 11:58:47 hal spawn-fcgi[21517]: spawn-fcgi: child exited with: 2
Nov  4 11:58:47 hal systemd[1]: munin-fcgi-graph.service: control process exited, code=exited status=2
Nov  4 11:58:47 hal systemd[1]: Unit munin-fcgi-graph.service entered failed state.
# systemctl status munin-fcgi-graph.service
munin-fcgi-graph.service - Munin FastCGI Graph
	  Loaded: loaded (/lib/systemd/system/munin-fcgi-graph.service; enabled)
	  Active: failed since Sun, 04 Nov 2012 11:58:47 -0800; 3min 14s ago
	 Process: 21517 ExecStart=/usr/bin/spawn-fcgi -s /run/munin/fcgi-graph.sock -U apache -u munin -g munin /var/www/html/munin/cgi/munin-cgi-graph -P /run/munin/fcgi-graph.pid (code=exited, status=2)
	  CGroup: name=systemd:/system/munin-fcgi-graph.service

That path to munin-cgi-graph is completely wrong, and that's hard coded wrong in /lib/systemd/system/munin-fcgi-graph.service.  Similar problem with munin-fcgi-html.service .  I made a copy of the service, fixed the incorrect path (/var/www/cgi-bin/munin-cgi-graph), and then it started.  

But CGI still didn't work.  Looking in the apache error log, I saw tons of:
munin-cgi-graph: Can't open /var/log/munin/munin-cgi-graph.log (Permission denied) at /usr/share/perl5/vendor_perl/Log/Log4perl/Appender/File.pm line 103.

Fixed/hacked by chgrp'ing /var/log/munin to 'apache', and making it group writable as well:
chgrp apache munin-cgi-graph.log && chmod g+w munin-cgi-graph.log

I can't tell if I'm doing it wrong, or if the bug isn't fixed.  On top of that, I still can't figure out exactly what munin-fcgi-graph.service is intended to accomplish.  Whether or not its running, cgi graphing works (after all the hacking detailed above).  

Additionally, in munin.conf I see:
# HTML files are normally generated by munin-html, no matter if the
# files are used or not. You can change this to on-demand generation
# by following the instructions in http://munin-monitoring.org/wiki/CgiHowto2
# 
# Notes: 
# - moving to CGI for HTML means you cannot have graph generated by cron.
# - cgi html has some bugs, mostly you still have to launch munin-html by hand
# 
html_strategy cron

What does "cgi html has some bugs, mostly you still have to launch munin-html by hand" mean exactly?  Running some command manually?  Setting html_strategy=cron ?  Something else?
Comment 9 Fedora Update System 2012-11-11 15:29:12 EST
munin-2.0.8-1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/munin-2.0.8-1.fc17
Comment 10 Fedora Update System 2012-11-11 15:31:13 EST
munin-2.0.8-1.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/munin-2.0.8-1.fc16
Comment 11 Fedora Update System 2012-11-11 15:33:10 EST
munin-2.0.8-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/munin-2.0.8-1.el6
Comment 12 Fedora Update System 2012-11-11 15:36:25 EST
munin-2.0.8-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/munin-2.0.8-1.el5
Comment 13 Fedora Update System 2012-11-20 22:57:56 EST
munin-2.0.8-1.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 14 Fedora Update System 2012-11-20 23:00:40 EST
munin-2.0.8-1.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 15 Fedora Update System 2012-11-28 00:05:41 EST
munin-2.0.8-1.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 16 Fedora Update System 2012-11-28 00:08:49 EST
munin-2.0.8-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 17 Halocaridina 2012-11-29 12:31:53 EST
Lack of expected functionality continues to exist with munin-2.0.8, specifically munin-2.0.8-1.el6 that has been pushed to the Fedora EPEL 6 stable repository.

Namely, no graph is displayed on zooming page (only ? in square).

Have been following Lonni J Friedman posts here and on the Munin Sourceforge list on manual hacks.  Unfortunately, files like munin-fcgi-graph.service don't seem to exist in the munin-2.0.8-1.el6 RPM so its not clear what hacks might get zoom working on EL6.

Otherwise, munin operates "as expected" (minus graph zooming ability).
Comment 18 Lonni J Friedman 2012-11-29 12:47:24 EST
agreed, re-opening.  The fact that the maintainer of these packages doesn't even acknowledge or respond to the feedback is incredibly frustrating.
Comment 19 d. johnson 2012-11-29 13:06:23 EST
Lonni: There is not a way to auto-use cgi.  This will always require manual intervention due to how many options there are available.

Halocaridina: you will likely want the munin-cgi sub-package.
Comment 20 Lonni J Friedman 2012-11-29 13:12:35 EST
Sorry, but I don't understand why there isn't a way to make cgi work automatically.  At a minimum you should update the /etc/munin/munin.conf and /etc/httpd/conf.d/munin.conf to include the necessary configuration commented out so that people can simply uncomment it if they wish to use cgi.  As I've noted above, CGI is the *default* for munin-2.x.  You should be shipping a configuration that has CGI enabled by default.  There's absolutely nothing in the munin setup to use CGI which requires any per-user customization.  I even went so far as to document everything that I needed to do to get CGI working with your RPMs here:
http://netllama.linux-sxs.org/llamaland/?p=1484

If you don't think this can be enabled by default, I'd like to hear an explanation why.
Comment 21 d. johnson 2012-11-29 13:20:35 EST
Changing your existing config files is against FPO policy.  This will not happen.

CGI is not the default for munin-2.0.  It was for a single point release, and rolled back. The default is cron updates.

The "yum install" packages should already be required via munin-cgi.  That was rectified several releases ago.  The config file changes are known, and will not change post-install, as above.
Comment 22 Lonni J Friedman 2012-11-29 13:28:52 EST
I wasn't suggesting that pre-existing installed config files be changed.  I was noting that for a new munin installation, what ships should include the CGI specific configuration.
Comment 23 Halocaridina 2012-11-29 15:46:59 EST
Lonni and d. johnson,

Between information and comments supplied by both of you, I am happy to say that my implementation of munin 2.0.8 on EL6 now has graph zooming ability.  Thank you again.

I document here what had to be done on a fully updated Scientific Linux 6.1 system for future reference.  Hope it proves useful to others on EL6.

1) yum --enablerepo=epel install mod_fcgid spawn-fcgi munin-cgi
(already had installed mod_fcgid spawn-fcgi from previous attempts to get this to work, but was missing  munin-cgi)

2) uncomment the two options in /etc/sysconfig/spawn-fcgi in order to be able to start spawn-fcgi via:

/etc/init.d/spawn-fcgi start

I'll need to go back and tweak /etc/sysconfig/spawn-fcgi based on possible options

3) chkconfig --level 2345 spawn-fcgi on (so spawn-fcgi starts on boot)

The below either comes directly from the link Lonni provided in Comment #20 above or is a slight modification)

4) touch /var/log/munin/munin-cgi-graph.log && touch /var/log/munin/munin-cgi-html.log

5) chgrp apache /var/log/munin/munin-cgi-* && chmod g+w /var/log/munin/munin-cgi-*

6) mkdir -p /var/lib/munin/cgi-tmp/munin-cgi-graph && chown -R munin.apache /var/lib/munin/cgi-tmp && chmod -R ug+w /var/lib/munin/cgi-tmp

(note in above that chmod -R ug+w is corrected relative to Lonni's documentation).

7) uncommented contents of /etc/munin/munin.conf are:

includedir /etc/munin/conf.d
html_strategy cgi
graph_strategy cron
cgiurl_graph /cgi-bin/munin-cgi-graph
html_strategy cron
[fully-qualified hostname]
    address 127.0.0.1
    use_node_name yes

8) create /etc/httpd/conf.d/munin-cgi.conf as specified in Lonni's post with following content:

Alias /static /etc/munin/static/
RewriteEngine on
RewriteRule ^/cgi-bin/munin-cgi-html(\/.*?)*/static/(.*) /static/$2 [R,L]
# Uncomment the following to redirect old, static URLs to the CGI-HTML
RewriteRule ^/munin/(.*) /cgi-bin/munin-cgi-html/$1 [R,L]
RewriteRule ^/cgi-bin/munin-cgi-html$ /cgi-bin/munin-cgi-html/ [R,L]

ScriptAlias /cgi-bin/munin-cgi-graph /var/www/cgi-bin/munin-cgi-graph
<Location /cgi-bin/munin-cgi-graph>
   Options +ExecCGI
   SetHandler fcgid-script
</Location>

ScriptAlias /cgi-bin/munin-cgi-html /var/www/cgi-bin/munin-cgi-html
<Location /cgi-bin/munin-cgi-html>
   Options +ExecCGI
   SetHandler fcgid-script
</Location>

9) /etc/init.d/httpd restart

10) /etc/init.d/munin-node stop && /etc/init.d/munin-node start
Comment 24 Halocaridina 2012-11-29 15:50:05 EST
Sorry for the noise, but one addition to the above Comment #23 is:

6.5) cp -R /var/www/cgi-bin/ /var/www/html/munin/cgi/
Comment 25 d. johnson 2012-11-29 18:15:46 EST
Much of what you ran is no longer required.

Step 1 should read:

1) yum --enablerepo=epel install munin-cgi

The rest is already Required.

2 and 3 are known and will remain as-is.

Steps 4,5,6.5 and half of 6 are not needed.  (Half of 6 because there is may be a bug regarding cgitmpdir: it should already be using /var/tmp/ by default.)

Your 7 appears to be odd.  I will have to verify what this actually uses because you have both cron and cgi listed for the same task.
Comment 26 Halocaridina 2012-11-29 18:49:38 EST
d. johnson,

Thank you for the clarification. 

#4 and #5 come from my previous attempts to get CGI/zooming ability working under 2.0.6. Without touching and changing permissions on those files, munin-logs were filled with "couldn't write to log file" errors (something also reported by Lonni).

#6 needed to be done since 1) these directories did not exist after installing munin-cgi and 2) the system was logging errors to /var/log/munin/munin-cgi-graph.log like:

 [WARNING] Could not draw graph "/var/lib/munin/cgi-tmp/munin-cgi-graph/DOMAIN/HOSTNAME/entropy-pinpoint=1354111513,1354219513.png?&lower_limit=&upper_limit=&size_x=800&size_y=400": /var/lib/munin/cgi-tmp/munin-cgi-graph/DOMAIN/HOSTNAME/entropy-pinpoint=1354111513,1354219513.png?&lower_limit=&upper_limit=&size_x=800&size_y=400

when attempting to zoom on a graph.  These errors disappeared once #6 was done.

I need to look further into whether #6.5 is really needed.  As for #7, that is odd.  I need to see whether commenting out "html_strategy cron" in munin.conf breaks things.  Right now, everything is working as I would expect and there are no errors being printed to any of the logs.
Comment 27 d. johnson 2012-11-29 23:45:42 EST
Two items:

1) 2.0.8-2 has the fix for the cgi-tmp bug.  It was patched and not rebuilt.  Should appear shortly in -testing repo.

2) Setup should look something like this:

yum --enablerepo=epel,epel-testing install munin-cgi

sed -i 's/\(.*\)_strategy.*/\1_strategy cgi/' /etc/munin/munin.conf

cp --backup /etc/sysconfig/spawn-fcgi-munin /etc/sysconfig/spawn-fcgi

for svc in spawn-fcgi httpd munin-node; do
service $svc stop
chkconfig $svc on
service $svc start
done


Except for the --enablerepo flag, the rest can be found in 'yum info munin-cgi' (after -2 pushes; because there is a copy of the upstream wiki httpd munin-cgi.conf found there as well sans vhost.)

Look for it, and provide karma when available.
Comment 28 Fedora Update System 2012-11-30 00:43:11 EST
munin-2.0.8-2.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/munin-2.0.8-2.fc18
Comment 29 Fedora Update System 2012-11-30 00:44:36 EST
munin-2.0.8-2.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/munin-2.0.8-2.fc17
Comment 30 Fedora Update System 2012-11-30 00:45:23 EST
munin-2.0.8-2.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/munin-2.0.8-2.fc16
Comment 31 Fedora Update System 2012-11-30 00:46:20 EST
munin-2.0.8-2.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/munin-2.0.8-2.el6
Comment 32 Fedora Update System 2012-11-30 00:46:57 EST
munin-2.0.8-2.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/munin-2.0.8-2.el5
Comment 33 Fedora Update System 2012-11-30 15:33:26 EST
Package munin-2.0.8-2.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing munin-2.0.8-2.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-19431/munin-2.0.8-2.fc18
then log in and leave karma (feedback).
Comment 34 Fedora Update System 2012-12-08 13:00:15 EST
munin-2.0.9-2.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/munin-2.0.9-2.fc18
Comment 35 Fedora Update System 2012-12-08 13:01:45 EST
munin-2.0.9-2.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/munin-2.0.9-2.fc17
Comment 36 Fedora Update System 2012-12-08 13:04:06 EST
munin-2.0.9-2.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/munin-2.0.9-2.fc16
Comment 37 Fedora Update System 2012-12-08 13:05:47 EST
munin-2.0.9-2.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/munin-2.0.9-2.el6
Comment 38 Fedora Update System 2012-12-08 13:06:42 EST
munin-2.0.9-2.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/munin-2.0.9-2.el5
Comment 39 Fedora Update System 2012-12-17 21:31:15 EST
munin-2.0.9-2.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 40 Fedora Update System 2012-12-17 21:32:12 EST
munin-2.0.9-2.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 41 Fedora Update System 2012-12-21 14:03:26 EST
munin-2.0.9-3.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/munin-2.0.9-3.el6
Comment 42 Fedora Update System 2012-12-21 14:04:23 EST
munin-2.0.9-3.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/munin-2.0.9-3.el5
Comment 43 Fedora Update System 2013-01-09 17:14:43 EST
munin-2.0.9-3.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 44 Fedora Update System 2013-01-09 17:16:18 EST
munin-2.0.9-3.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 45 Fedora Update System 2013-01-11 18:15:43 EST
munin-2.0.9-2.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.