Fix #5119
This commit is contained in:
parent
88c88fe505
commit
dedc1caf26
|
@ -49,7 +49,7 @@ sub new {
|
||||||
|
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments =>
|
||||||
{
|
{
|
||||||
"ignore-perfdata" => { name => 'ignore_perfdata' },
|
"filter-perfdata:s" => { name => 'filter_perfdata' },
|
||||||
"verbose" => { name => 'verbose' },
|
"verbose" => { name => 'verbose' },
|
||||||
"opt-exit:s" => { name => 'opt_exit', default => 'unknown' },
|
"opt-exit:s" => { name => 'opt_exit', default => 'unknown' },
|
||||||
"output-xml" => { name => 'output_xml' },
|
"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}}) {
|
foreach (@{$self->{perfdatas}}) {
|
||||||
|
next if (defined($self->{option_results}->{filter_perfdata}) &&
|
||||||
|
$_->{label} !~ /$self->{option_results}->{filter_perfdata}/);
|
||||||
|
|
||||||
my %values = ();
|
my %values = ();
|
||||||
foreach my $key (keys %$_) {
|
foreach my $key (keys %$_) {
|
||||||
$values{$key} = $_->{$key};
|
$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}}) {
|
foreach (@{$self->{perfdatas}}) {
|
||||||
|
next if (defined($self->{option_results}->{filter_perfdata}) &&
|
||||||
|
$_->{label} !~ /$self->{option_results}->{filter_perfdata}/);
|
||||||
|
|
||||||
my ($child_perfdata);
|
my ($child_perfdata);
|
||||||
$child_perfdata = $self->{xml_output}->createElement("perfdata");
|
$child_perfdata = $self->{xml_output}->createElement("perfdata");
|
||||||
$child_plugin_perfdata->addChild($child_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});
|
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";
|
print "\n";
|
||||||
} else {
|
} else {
|
||||||
print "|";
|
print "|";
|
||||||
foreach (@{$self->{perfdatas}}) {
|
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 " '" . $_->{label} . "'=" . $_->{value} . $_->{unit} . ";" . $_->{warning} . ";" . $_->{critical} . ";" . $_->{min} . ";" . $_->{max} . ";";
|
||||||
}
|
}
|
||||||
print "\n";
|
print "\n";
|
||||||
|
@ -625,9 +633,9 @@ Output class
|
||||||
|
|
||||||
Display long output.
|
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>
|
=item B<--opt-exit>
|
||||||
|
|
||||||
|
|
|
@ -127,10 +127,7 @@ WHERE name IN
|
||||||
my $diff_dskreads = $new_datas->{dskreads} - $old_dskreads;
|
my $diff_dskreads = $new_datas->{dskreads} - $old_dskreads;
|
||||||
my $diff_bufwrites = $new_datas->{bufwrites} - $old_bufwrites;
|
my $diff_bufwrites = $new_datas->{bufwrites} - $old_bufwrites;
|
||||||
my $diff_dskwrites = $new_datas->{dskwrites} - $old_dskwrites;
|
my $diff_dskwrites = $new_datas->{dskwrites} - $old_dskwrites;
|
||||||
|
|
||||||
use Data::Dumper;
|
|
||||||
print Data::Dumper::Dumper($new_datas);
|
|
||||||
|
|
||||||
# 100 * (bufreads - dskreads) / bufreads
|
# 100 * (bufreads - dskreads) / bufreads
|
||||||
# 100 * (bufwrits - dskwrits) / bufwrits
|
# 100 * (bufwrits - dskwrits) / bufwrits
|
||||||
my %prcts = ();
|
my %prcts = ();
|
||||||
|
|
Loading…
Reference in New Issue