From c9cdeb81ab8fd71dbe642b6569c2a1b98fd11901 Mon Sep 17 00:00:00 2001 From: Pavel Piatruk Date: Fri, 22 Jan 2010 09:13:29 +0100 Subject: [PATCH] contrib/collection.cgi: Added ability to hide specified types. It is useful when you don't want to see many graphs. How to use the patch: apply it to collection.cgi and add lines with keyword ,,dontshowtype'' to /etc/collectd/collection.conf: dontshowtype: "if_errors" dontshowtype: "if_packets" Then you will see only if_octets types in "interface" plugin page. Via Debian bug #566199. --- contrib/collection.cgi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contrib/collection.cgi b/contrib/collection.cgi index cbdb76e8..100c0c73 100755 --- a/contrib/collection.cgi +++ b/contrib/collection.cgi @@ -13,6 +13,7 @@ use Data::Dumper (); our $Config = "/etc/collection.conf"; our @DataDirs = (); +our @DontShowTypes = (); our $LibDir; our $ValidTimespan = @@ -78,6 +79,10 @@ sub read_config $value =~ s#/*$##; $LibDir = $value; } + elsif ($key eq 'dontshowtype') + { + push (@DontShowTypes, $value); + } else { print STDERR "Unknown key: $key\n"; @@ -239,6 +244,7 @@ sub _find_types my $name = "$_"; $name =~ s/\.rrd$//i; my ($type, $instance) = split (m/-/, $name, 2); + if (grep { $_ eq $type } @DontShowTypes) { next; } $types{$type} = [] if (!$types{$type}); push (@{$types{$type}}, $instance) if (defined ($instance)); } -- 2.30.2