From: Pavel Piatruk Date: Fri, 22 Jan 2010 08:13:29 +0000 (+0100) Subject: contrib/collection.cgi: Added ability to hide specified types. X-Git-Tag: collectd-4.8.4~32 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c9cdeb81ab8fd71dbe642b6569c2a1b98fd11901;p=collectd.git 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. --- 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)); }