#832 reopened defect

Nested groups and munin-cgi-graph don't mix

Reported by: zandr@… Owned by: snide
Priority: normal Milestone: Munin 2.0.0
Component: web-interface Version: 1.4.1
Severity: normal Keywords:
Cc:

Description

I posted on munin-users about this as well, but I'll open a ticket here.

munin-cgi-graph parses the PATH_INFO environment variable assuming it's going to get $dom/$host/$serv-$scale.png, and splitting first on /, then on - to get $serv and $scale.

The problem is in nested groups, you're going to get extra elements on the front of that string for the subgroups. Even more entertaining, if you have dashes in your hostnames, you end up with part of your hostname in $scale, which produces weird errors. (Literally: "Weird scale setting "hostname.domain.tld". Bailing Out")

Not sure what $dom actually gets used for, so I'm not sure how to fix parsing the PATH_INFO.

Attachments (1)

fix_munin832.patch (8.6 KB) - added by Elbandi80 at 2010-11-30T15:43:10+01:00.
Backport to 1.4

Download all attachments as: .zip

Change History (16)

comment:1 Changed at 2010-01-04T06:53:49+01:00 by ssm

  • Owner changed from nobody to ssm
  • Status changed from new to assigned

Related to #769, possibly a duplicate.

comment:2 Changed at 2010-01-04T06:54:10+01:00 by ssm

  • Owner ssm deleted
  • Status changed from assigned to new

comment:3 Changed at 2010-01-04T11:59:06+01:00 by mancz

In my installation the following fix works:

Replace the following lines:

    $path =~ s/^\///;
    ($dom, $host, $serv) = split /\//, $path;
    ($serv, $scale) = split /-/, $serv, 2;
    $scale =~ s/\.png$//;

With:

    ($dom, $host, $serv, $scale) = $path =~ m#^/(.*)/([^/]+)/(.*)-(.*).png$#;

comment:4 Changed at 2010-01-15T08:54:05+01:00 by snide

  • Owner set to snide
  • Status changed from new to assigned

comment:5 Changed at 2010-01-19T20:10:02+01:00 by snide

  • Milestone changed from Munin 1.4.4 to Munin 1.5

The biggest pb is that multigraph plugins are listed just as one service in the $work_array of munin-graph.process_work().

This means that we have either to :

  • graph everything for this plugins (easier, but slower : many unused graph will be generated)
  • have a better granularity for $work_array (invasive, but CGI would be much faster)

comment:6 follow-up: Changed at 2010-01-24T21:29:48+01:00 by dhr

mancz works for me. However there's another issue: both in host and in diskstats group view the image sizes set by graph_width and graph_height in /etc/munin.conf get ignored. Other plugins get drawn just fine.
HTH
Daniel

comment:7 in reply to: ↑ 6 Changed at 2010-01-25T09:09:02+01:00 by snide

Replying to dhr:

mancz works for me.

Actually, the patch works for nested groups, but doesn't for multigraph plugins. It also isn't compatible with my CGI evolution that generates the png in a different path, to avoid permission problems since apache usually doesn't run as munin.

However there's another issue: both in host and in diskstats group view the image sizes set by graph_width and graph_height in /etc/munin.conf get ignored. Other plugins get drawn just fine.

I'm thinking I'll just create several tickets to be able to track individually each issue.

comment:8 Changed at 2010-02-14T17:08:16+01:00 by snide

Fixed in r3329.

Added a --fdqn to unify multigraph & nested plugins.

comment:9 Changed at 2010-02-14T17:08:24+01:00 by snide

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:10 Changed at 2010-03-12T00:23:05+01:00 by blueyed

Can it get backported to 1.4.4?
Is there another way to fix this for 1.4.4 - especially regarding the diskstat plugin.

comment:11 Changed at 2010-05-24T19:17:22+02:00 by dhr

Hi,

I wrote a patch which fixes the issue for me.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=582786#10

Cheers Daniel

Changed at 2010-11-30T15:43:10+01:00 by Elbandi80

Backport to 1.4

comment:12 Changed at 2011-03-06T17:42:25+01:00 by blueyed

  • Resolution fixed deleted
  • Status changed from closed to reopened

I am not sure about nested groups, and if I have them setup after all (please tell me what they are), but this patch does not appear to work for multigraph (what diskstats_iops appears to be, correct?), e.g. "/$domain/$host/diskstats_iops/index.html".

The regular expression to match domain, host, service and scale is:
m#/(.*)/([/]+)/(\w+)-(\w+)\.png#;

However, this will match "/$domain/$host/diskstats_iops/mapper_fncrypt-day.png" into:
scale: day
service: mapper_fncrypt
host: diskstats_iops
domain: $domain/$host

I have changed it to "m#/([/]+)/([/]+)/((?:.*/)?\w+)-(\w+)\.png#", which appears to work fine, in the sense that it now generates images.

btw: the original patch from dhr has been added to Ubuntu, and I will change it as outlined below, in case I am missing nothing obvious here.

comment:13 Changed at 2011-03-06T17:44:46+01:00 by blueyed

Sorry for the markup mess, here are the regular expressions from the comment above:

current regexp:
m#^/(.*)/([^/]+)/(\w+)-(\w+)\.png#

fixed(?) regexp:
m#^/([^/]+)/([^/]+)/((?:.*/)?\w+)-(\w+)\.png#

comment:14 Changed at 2012-02-02T16:12:36+01:00 by snide

Can you test with a recent build ?

I'm going to close it again in a few days, as I didn't manage to reproduce it lately

comment:15 Changed at 2012-10-23T15:42:50+02:00 by al

Still happening for me with Debian package version 2.0.6-1.

Request path is /munin-cgi/munin-cgi-graph/localdomain/localhost.localdomain/sensors_fan-day.png
asked for (munin-cgi/munin-cgi-graph/localdomain, localhost.localdomain, sensors_fan, day)

Changing the regexp to

m#([^/]*)/([^/]+)/([\w-]+)-([\w=,]+)\.png#

or

m#^/([^/]+)/([^/]+)/((?:.*/)?\w+)-(\w+)\.png#

solves this.

Note: See TracTickets for help on using tickets.