From dedc1caf26b15af761ea631cc3df87ead74008d1 Mon Sep 17 00:00:00 2001 From: Quentin Garnier Date: Wed, 15 Jan 2014 11:12:01 +0100 Subject: [PATCH] Fix #5119 --- centreon/plugins/output.pm | 20 ++++++++++++++------ database/informix/mode/globalcache.pm | 5 +---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/centreon/plugins/output.pm b/centreon/plugins/output.pm index 354d06bfd..7a853ecfb 100644 --- a/centreon/plugins/output.pm +++ b/centreon/plugins/output.pm @@ -49,7 +49,7 @@ sub new { $options{options}->add_options(arguments => { - "ignore-perfdata" => { name => 'ignore_perfdata' }, + "filter-perfdata:s" => { name => 'filter_perfdata' }, "verbose" => { name => 'verbose' }, "opt-exit:s" => { name => 'opt_exit', default => 'unknown' }, "output-xml" => { name => 'output_xml' }, @@ -188,8 +188,11 @@ sub output_json { } } - if (!defined($self->{option_results}->{ignore_perfdata}) && $options{force_ignore_perfdata} == 1) { + if ($options{force_ignore_perfdata} == 0) { foreach (@{$self->{perfdatas}}) { + next if (defined($self->{option_results}->{filter_perfdata}) && + $_->{label} !~ /$self->{option_results}->{filter_perfdata}/); + my %values = (); foreach my $key (keys %$_) { $values{$key} = $_->{$key}; @@ -270,8 +273,11 @@ sub output_xml { } } - if (!defined($self->{option_results}->{ignore_perfdata}) && $options{force_ignore_perfdata} == 1) { + if ($options{force_ignore_perfdata} == 0) { foreach (@{$self->{perfdatas}}) { + next if (defined($self->{option_results}->{filter_perfdata}) && + $_->{label} !~ /$self->{option_results}->{filter_perfdata}/); + my ($child_perfdata); $child_perfdata = $self->{xml_output}->createElement("perfdata"); $child_plugin_perfdata->addChild($child_perfdata); @@ -307,11 +313,13 @@ sub output_txt { print (($options{nolabel} == 0 ? 'OK: ' : '') . $self->{global_short_concat_outputs}->{OK}); } - if ($force_ignore_perfdata == 1 || defined($self->{option_results}->{ignore_perfdata})) { + if ($force_ignore_perfdata == 1) { print "\n"; } else { print "|"; foreach (@{$self->{perfdatas}}) { + next if (defined($self->{option_results}->{filter_perfdata}) && + $_->{label} !~ /$self->{option_results}->{filter_perfdata}/); print " '" . $_->{label} . "'=" . $_->{value} . $_->{unit} . ";" . $_->{warning} . ";" . $_->{critical} . ";" . $_->{min} . ";" . $_->{max} . ";"; } print "\n"; @@ -625,9 +633,9 @@ Output class Display long output. -=item B<--ignore-perfdata> +=item B<--filter-perfdata> -Don't display perfdata. +Filter perfdata that match the regexp. =item B<--opt-exit> diff --git a/database/informix/mode/globalcache.pm b/database/informix/mode/globalcache.pm index 8db0060bf..63741a352 100644 --- a/database/informix/mode/globalcache.pm +++ b/database/informix/mode/globalcache.pm @@ -127,10 +127,7 @@ WHERE name IN my $diff_dskreads = $new_datas->{dskreads} - $old_dskreads; my $diff_bufwrites = $new_datas->{bufwrites} - $old_bufwrites; my $diff_dskwrites = $new_datas->{dskwrites} - $old_dskwrites; - - use Data::Dumper; - print Data::Dumper::Dumper($new_datas); - + # 100 * (bufreads - dskreads) / bufreads # 100 * (bufwrits - dskwrits) / bufwrits my %prcts = ();