Hi again,
I totally missed the fact that with the previous patch on multigraph-pages
within every device-specific graph *all* devices were drawn.
The attached patch (incorporates the previous one) fixes that:
- first of all, munin-cgi-graph prints the device-specific image url instead of
the combined-devices-image url
- since munin-cgi-graph calls munin-graph with --service parameter, we have to
change the matching on @limit_services, that is take into account another
level of nesting, which is why I match on the name of the parent node as well.
Without this, only the combined-devices image would be generated but not the
device-specific ones.
Cheers,
Daniel
--- /usr/lib/cgi-bin/munin-cgi-graph.org 2010-05-23 17:59:21.121176136 +0200
+++ /usr/lib/cgi-bin/munin-cgi-graph 2010-05-24 18:41:35.157176446 +0200
@@ -58,14 +58,22 @@
my $dom = "";
my $lock = "";
my $IPC_KEY = 89340;
+my $multigraph_obj = "";
my $config = &munin_readconfig ($conffile);
my $path = $ENV{PATH_INFO} || "";
$path =~ s/^\///;
-($dom, $host, $serv) = split /\//, $path;
-($serv, $scale) = split /-/, $serv, 2;
-$scale =~ s/\.png$//;
+($dom, $host, $serv, $scale) = split /\//, $path;
+if (!defined($scale)) {
+ # assume classic single-graph image request
+ ($serv, $scale) = split /-/, $serv, 2;
+ $scale =~ s/\.png$//;
+} else {
+ # assume multi-graph image request
+ $scale =~ s/(.*)-([a-z]*?)\.png$/$2/;
+ $multigraph_obj = $1;
+}
&verify_parameters ($dom, $host, $serv, $scale);
@@ -181,7 +189,11 @@
my $service = shift;
my $scale = shift;
- return "$config->{'htmldir'}/$domain/$name/$service-$scale.png";
+ if ($multigraph_obj eq "") {
+ return "$config->{'htmldir'}/$domain/$name/$service-$scale.png";
+ } else {
+ return "$config->{'htmldir'}/$domain/$name/$service/$multigraph_obj-$scale.png";
+ }
}
--- /usr/share/perl5/Munin/Master/GraphOld.pm.org 2010-05-23 23:39:56.445182141 +0200
+++ /usr/share/perl5/Munin/Master/GraphOld.pm 2010-05-24 18:36:40.745176218 +0200
@@ -1343,9 +1343,15 @@
sub skip_service {
my $service = shift;
my $sname = munin_get_node_name($service);
+ my $parent_sname = munin_get_node_name(munin_get_parent($service));
# Skip if we've limited services with cli options
- return 1 if (@limit_services and !grep /^$sname$/, @limit_services);
+ return 1 if (@limit_services and
+ # search node name (single graph)
+ (!grep /^$sname$/, @limit_services) and
+ # search parent node name (multi graph)
+ (!grep /^$parent_sname$/, @limit_services)
+ );
# Always graph if --force is present
return 0 if $force_graphing;