Refs #5166
This commit is contained in:
parent
ed772c5ea7
commit
d39518e7f8
|
@ -64,6 +64,7 @@ sub new {
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments =>
|
||||||
{
|
{
|
||||||
|
"skip-not-present" => { name => 'skip_not_present' },
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
|
@ -100,6 +101,12 @@ sub run {
|
||||||
$self->{output}->output_add(long_msg => sprintf("%s sensor '%s' state is %s.",
|
$self->{output}->output_add(long_msg => sprintf("%s sensor '%s' state is %s.",
|
||||||
$object_map{$object}, $instance,
|
$object_map{$object}, $instance,
|
||||||
${$states{$status}}[0]));
|
${$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') {
|
if (${$states{$status}}[1] ne 'OK') {
|
||||||
$self->{output}->output_add(severity => ${$states{$status}}[1],
|
$self->{output}->output_add(severity => ${$states{$status}}[1],
|
||||||
short_msg => sprintf("%s sensor '%s' state is %s.",
|
short_msg => sprintf("%s sensor '%s' state is %s.",
|
||||||
|
@ -122,6 +129,10 @@ Check sensors (hpicfChassis.mib).
|
||||||
|
|
||||||
=over 8
|
=over 8
|
||||||
|
|
||||||
|
=item B<--skip-not-present>
|
||||||
|
|
||||||
|
No warning for state 'not present'.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
|
@ -51,6 +51,7 @@ sub new {
|
||||||
'environment' => 'network::hp::procurve::mode::environment',
|
'environment' => 'network::hp::procurve::mode::environment',
|
||||||
'memory' => 'network::hp::procurve::mode::memory',
|
'memory' => 'network::hp::procurve::mode::memory',
|
||||||
'traffic' => 'snmp_standard::mode::traffic',
|
'traffic' => 'snmp_standard::mode::traffic',
|
||||||
|
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
|
|
|
@ -153,7 +153,7 @@ sub run {
|
||||||
|
|
||||||
my $result = $self->{snmp}->get_leef();
|
my $result = $self->{snmp}->get_leef();
|
||||||
$new_datas->{last_timestamp} = time();
|
$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})) {
|
if (!defined($self->{option_results}->{interface}) || defined($self->{option_results}->{use_regexp})) {
|
||||||
$self->{output}->output_add(severity => 'OK',
|
$self->{output}->output_add(severity => 'OK',
|
||||||
short_msg => 'All traffic are 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 . "." . $_}));
|
$interface_speed = (defined($result->{$oid_speed64 . "." . $_}) && $result->{$oid_speed64 . "." . $_} ne '' ? ($result->{$oid_speed64 . "." . $_} * 1000000) : ($result->{$oid_speed32 . "." . $_}));
|
||||||
if ($interface_speed == 0) {
|
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;
|
next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,7 +216,6 @@ sub run {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
$old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp');
|
|
||||||
my $old_in = $self->{statefile_value}->get(name => 'in_' . $_);
|
my $old_in = $self->{statefile_value}->get(name => 'in_' . $_);
|
||||||
my $old_out = $self->{statefile_value}->get(name => 'out_' . $_);
|
my $old_out = $self->{statefile_value}->get(name => 'out_' . $_);
|
||||||
if (!defined($old_timestamp) || !defined($old_in) || !defined($old_out)) {
|
if (!defined($old_timestamp) || !defined($old_in) || !defined($old_out)) {
|
||||||
|
|
Loading…
Reference in New Issue