From: Jerome Oufella Date: Wed, 1 Sep 2010 18:35:58 +0000 (-0400) Subject: collection3: fix multiple hosts selection issue X-Git-Tag: collectd-4.9.4~16 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c111c711510ee3903a01df61db0fdf74ad27297f;p=collectd.git collection3: fix multiple hosts selection issue When selecting multiple hosts in collection3's hosts list, and with some plugins only (the ones that use a specific resource name such as memory or tcpconns), the resulting graph list will be limited to one single graph (instead of one per host). This patch addresses this issue by modifying the name of the hash key in the group_files_by_plugin_instance function, making it less prone to name collisions by prefixing it by the host name. Comments and enhancements will be welcome. Signed-off-by: Jerome Oufella Signed-off-by: Florian Forster --- diff --git a/contrib/collection3/lib/Collectd/Graph/Common.pm b/contrib/collection3/lib/Collectd/Graph/Common.pm index f88c22b5..c6e25081 100644 --- a/contrib/collection3/lib/Collectd/Graph/Common.pm +++ b/contrib/collection3/lib/Collectd/Graph/Common.pm @@ -106,7 +106,9 @@ sub group_files_by_plugin_instance for (my $i = 0; $i < @files; $i++) { my $file = $files[$i]; - my $key = $file->{'plugin_instance'} || ''; + my $key1 = $file->{'hostname'} || ''; + my $key2 = $file->{'plugin_instance'} || ''; + my $key = "$key1-$key2"; $data->{$key} ||= []; push (@{$data->{$key}}, $file);