diff --git a/network/hp/procurve/mode/environment.pm b/network/hp/procurve/mode/environment.pm index 731c74cc4..e3c6e9c27 100644 --- a/network/hp/procurve/mode/environment.pm +++ b/network/hp/procurve/mode/environment.pm @@ -63,7 +63,8 @@ sub new { $self->{version} = '1.0'; $options{options}->add_options(arguments => - { + { + "skip-not-present" => { name => 'skip_not_present' }, }); return $self; @@ -100,6 +101,12 @@ sub run { $self->{output}->output_add(long_msg => sprintf("%s sensor '%s' state is %s.", $object_map{$object}, $instance, ${$states{$status}}[0])); + if (defined($self->{option_results}->{skip_not_present}) && + $status == 5) { + $self->{output}->output_add(long_msg => sprintf("Skipping %s sensor '%s'.", + $object_map{$object}, $instance)); + next; + } if (${$states{$status}}[1] ne 'OK') { $self->{output}->output_add(severity => ${$states{$status}}[1], short_msg => sprintf("%s sensor '%s' state is %s.", @@ -122,6 +129,10 @@ Check sensors (hpicfChassis.mib). =over 8 +=item B<--skip-not-present> + +No warning for state 'not present'. + =back =cut diff --git a/network/hp/procurve/plugin.pm b/network/hp/procurve/plugin.pm index ec3239f61..66b8219a9 100644 --- a/network/hp/procurve/plugin.pm +++ b/network/hp/procurve/plugin.pm @@ -47,10 +47,11 @@ sub new { $self->{version} = '1.0'; %{$self->{modes}} = ( - 'cpu' => 'network::hp::procurve::mode::cpu', - 'environment' => 'network::hp::procurve::mode::environment', - 'memory' => 'network::hp::procurve::mode::memory', - 'traffic' => 'snmp_standard::mode::traffic', + 'cpu' => 'network::hp::procurve::mode::cpu', + 'environment' => 'network::hp::procurve::mode::environment', + 'memory' => 'network::hp::procurve::mode::memory', + 'traffic' => 'snmp_standard::mode::traffic', + 'list-interfaces' => 'snmp_standard::mode::listinterfaces', ); return $self; diff --git a/snmp_standard/mode/traffic.pm b/snmp_standard/mode/traffic.pm index 7e1b1462b..beff6b8f2 100644 --- a/snmp_standard/mode/traffic.pm +++ b/snmp_standard/mode/traffic.pm @@ -153,7 +153,7 @@ sub run { my $result = $self->{snmp}->get_leef(); $new_datas->{last_timestamp} = time(); - my $old_timestamp; + my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp'); if (!defined($self->{option_results}->{interface}) || defined($self->{option_results}->{use_regexp})) { $self->{output}->output_add(severity => 'OK', short_msg => 'All traffic are ok'); @@ -175,6 +175,8 @@ sub run { } $interface_speed = (defined($result->{$oid_speed64 . "." . $_}) && $result->{$oid_speed64 . "." . $_} ne '' ? ($result->{$oid_speed64 . "." . $_} * 1000000) : ($result->{$oid_speed32 . "." . $_})); if ($interface_speed == 0) { + $self->{output}->output_add(severity => 'UNKNOWN', + short_msg => "Interface '" . $display_value . "' Speed is 0. You should force the value with --speed option"); next; } } @@ -214,7 +216,6 @@ sub run { next; } - $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp'); my $old_in = $self->{statefile_value}->get(name => 'in_' . $_); my $old_out = $self->{statefile_value}->get(name => 'out_' . $_); if (!defined($old_timestamp) || !defined($old_in) || !defined($old_out)) {