[collectd] [PATCH] collection3: fix multiple hosts selection issue
Jerome Oufella
jerome.oufella at savoirfairelinux.com
Wed Sep 1 20:35:58 CEST 2010
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 <jerome.oufella at savoirfairelinux.com>
---
contrib/collection3/lib/Collectd/Graph/Common.pm | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/contrib/collection3/lib/Collectd/Graph/Common.pm b/contrib/collection3/lib/Collectd/Graph/Common.pm
index f88c22b..c6e2508 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);
--
1.7.0.4
More information about the collectd
mailing list