summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5fd83d4)
raw | patch | inline | side by side (parent: 5fd83d4)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 5 Mar 2009 08:35:28 +0000 (09:35 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 5 Mar 2009 08:36:45 +0000 (09:36 +0100) |
Used by the "GenericStacked" graphs.
contrib/collection3/lib/Collectd/Graph/Type/GenericStacked.pm | patch | blob | history | |
contrib/collection3/lib/Collectd/Graph/TypeLoader.pm | patch | blob | history |
diff --git a/contrib/collection3/lib/Collectd/Graph/Type/GenericStacked.pm b/contrib/collection3/lib/Collectd/Graph/Type/GenericStacked.pm
index a1a3e1cd7f9459bc2245e55df50b78883446c7be..ab95ee2f3f145c6bfdf735e158315f69f053f22a 100644 (file)
my $colors = $obj->{'rrd_colors'} || {};
my @ret = ('-t', $rrd_title, @$rrd_opts);
+ my $ignore_unknown = $obj->{'ignore_unknown'} || 0;
+ if ($ignore_unknown)
+ {
+ if ($ignore_unknown =~ m/^(yes|true|on)$/i)
+ {
+ $ignore_unknown = 1;
+ }
+ else
+ {
+ $ignore_unknown = 0;
+ }
+ }
+
if (defined $obj->{'rrd_vertical'})
{
push (@ret, '-v', $obj->{'rrd_vertical'});
sort_idents_by_type_instance ($idents, $obj->{'custom_order'});
}
+ if ($ignore_unknown)
+ {
+ my $new_idents = [];
+ for (@$idents)
+ {
+ if (exists ($obj->{'ds_names'}{$_->{'type_instance'}}))
+ {
+ push (@$new_idents, $_);
+ }
+ }
+
+ if (@$new_idents)
+ {
+ $idents = $new_idents;
+ }
+ }
+
$obj->{'ds_names'} ||= {};
my @names = map { $obj->{'ds_names'}{$_->{'type_instance'}} || $_->{'type_instance'} } (@$idents);
diff --git a/contrib/collection3/lib/Collectd/Graph/TypeLoader.pm b/contrib/collection3/lib/Collectd/Graph/TypeLoader.pm
index c5fe613f8fa65a5771380f8801e1fd5a77b49ffb..2452b2a005489d442a2f446aec2ba541113fa250 100644 (file)
=cut
-# Copyright (C) 2008 Florian octo Forster <octo at verplant.org>
+# Copyright (C) 2008,2009 Florian octo Forster <octo at verplant.org>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
@Collectd::Graph::TypeLoader::EXPORT_OK = ('tl_load_type');
our @ArrayMembers = (qw(data_sources rrd_opts custom_order));
-our @ScalarMembers = (qw(rrd_title rrd_format rrd_vertical scale));
+our @ScalarMembers = (qw(rrd_title rrd_format rrd_vertical scale ignore_unknown));
our @DSMappedMembers = (qw(ds_names rrd_colors));
our %MemberToConfigMap =
rrd_vertical => 'rrdverticallabel',
rrd_colors => 'color',
scale => 'scale', # GenericIO only
- custom_order => 'order' # GenericStacked only
+ custom_order => 'order', # GenericStacked only
+ ignore_unknown => 'ignoreunknown' # GenericStacked only
);
return (1);