X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=contrib%2Fcollection3%2Flib%2FCollectd%2FGraph%2FType%2FGenericStacked.pm;h=ab95ee2f3f145c6bfdf735e158315f69f053f22a;hb=22bb251996a1b114197ad47b85d818a2962ddf0e;hp=a1a3e1cd7f9459bc2245e55df50b78883446c7be;hpb=5fd83d4edf600262af05cf7dbed9f246aa0053df;p=collectd.git diff --git a/contrib/collection3/lib/Collectd/Graph/Type/GenericStacked.pm b/contrib/collection3/lib/Collectd/Graph/Type/GenericStacked.pm index a1a3e1cd..ab95ee2f 100644 --- a/contrib/collection3/lib/Collectd/Graph/Type/GenericStacked.pm +++ b/contrib/collection3/lib/Collectd/Graph/Type/GenericStacked.pm @@ -49,6 +49,19 @@ sub getRRDArgs 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'}); @@ -59,6 +72,23 @@ sub getRRDArgs 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);