From c111c711510ee3903a01df61db0fdf74ad27297f Mon Sep 17 00:00:00 2001 From: Jerome Oufella Date: Wed, 1 Sep 2010 14:35:58 -0400 Subject: [PATCH] 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 --- contrib/collection3/lib/Collectd/Graph/Common.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- 2.11.0