1851a70ea67bb12a50e6e3fd3b6db89ae2c46df8
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## bts566199_collection_hide_types.dpatch by Pavel Piatruk
3 ## <piatruk.p@gmail.com>
4 ##
5 ## DP: contrib/collection.cgi: Added ability to hide specified types.
7 @DPATCH@
9 diff a/contrib/collection.cgi b/contrib/collection.cgi
10 --- a/contrib/collection.cgi
11 +++ b/contrib/collection.cgi
12 @@ -13,6 +13,7 @@ use Data::Dumper ();
14 our $Config = "/etc/collection.conf";
15 our @DataDirs = ();
16 +our @DontShowTypes = ();
17 our $LibDir;
19 our $ValidTimespan =
20 @@ -78,6 +79,10 @@ sub read_config
21 $value =~ s#/*$##;
22 $LibDir = $value;
23 }
24 + elsif ($key eq 'dontshowtype')
25 + {
26 + push (@DontShowTypes, $value);
27 + }
28 else
29 {
30 print STDERR "Unknown key: $key\n";
31 @@ -239,6 +244,7 @@ sub _find_types
32 my $name = "$_";
33 $name =~ s/\.rrd$//i;
34 my ($type, $instance) = split (m/-/, $name, 2);
35 + if (grep { $_ eq $type } @DontShowTypes) { next; }
36 $types{$type} = [] if (!$types{$type});
37 push (@{$types{$type}}, $instance) if (defined ($instance));
38 }