From a4e05f9c7db40fe70b8e568f44f7ed7d65914ef6 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Tue, 26 Nov 2019 14:02:53 +0100 Subject: [PATCH] fix qosusage cisco --- .../centreon/common/cisco/standard/snmp/mode/qosusage.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/centreon-plugins/centreon/common/cisco/standard/snmp/mode/qosusage.pm b/centreon-plugins/centreon/common/cisco/standard/snmp/mode/qosusage.pm index abba61e39..b574efcc9 100644 --- a/centreon-plugins/centreon/common/cisco/standard/snmp/mode/qosusage.pm +++ b/centreon-plugins/centreon/common/cisco/standard/snmp/mode/qosusage.pm @@ -37,7 +37,7 @@ sub set_counters { $self->{maps_counters}->{interface_classmap} = [ { label => 'int-cmap-traffic', set => { - key_values => [ { name => 'display' }, { name => 'traffic_usage', diff => 1 }, { name => 'total' } ], + key_values => [ { name => 'traffic_usage', diff => 1 }, { name => 'total' }, { name => 'display' } ], per_second => 1, closure_custom_calc => $self->can('custom_traffic_calc'), closure_custom_output => $self->can('custom_traffic_output'), @@ -120,7 +120,7 @@ sub custom_traffic_perfdata { value => sprintf("%.2f", $self->{result_values}->{traffic_per_seconds}), warning => $warning, critical => $critical, - min => 0, max => $self->{result_values}->{total} + min => 0, max => ($self->{result_values}->{total} =~ /[0-9]/ ? $self->{result_values}->{total} : undef) ); } @@ -128,7 +128,8 @@ sub custom_traffic_threshold { my ($self, %options) = @_; my $exit = 'ok'; - if ($self->{instance_mode}->{option_results}->{units_traffic} eq '%' && defined($self->{result_values}->{total})) { + if ($self->{instance_mode}->{option_results}->{units_traffic} eq '%' && + (defined($self->{result_values}->{total}) && $self->{result_values}->{total} =~ /[0-9]/)) { $exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{traffic_prct}, threshold => [ { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, { label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' } ]); } elsif ($self->{instance_mode}->{option_results}->{units_traffic} eq 'b/s') { $exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{traffic_per_seconds}, threshold => [ { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, { label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' } ]);