change hardware brocade section name

This commit is contained in:
qgarnier 2017-05-04 16:28:11 +02:00
parent 6c1141c956
commit 49eab090d1

View File

@ -28,7 +28,7 @@ use warnings;
sub set_system { sub set_system {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{regexp_threshold_overload_check_section_option} = '^(global|sensor)$'; $self->{regexp_threshold_overload_check_section_option} = '^(switch|sensor)$';
$self->{regexp_threshold_numeric_check_section_option} = '^(temperature|fan)$'; $self->{regexp_threshold_numeric_check_section_option} = '^(temperature|fan)$';
$self->{cb_hook2} = 'snmp_execute'; $self->{cb_hook2} = 'snmp_execute';
@ -42,7 +42,7 @@ sub set_system {
['above-max', 'CRITICAL'], ['above-max', 'CRITICAL'],
['absent', 'OK'], ['absent', 'OK'],
], ],
global => [ switch => [
['online', 'OK'], ['online', 'OK'],
['offline', 'WARNING'], ['offline', 'WARNING'],
['testing', 'WARNING'], ['testing', 'WARNING'],
@ -52,7 +52,7 @@ sub set_system {
}; };
$self->{components_path} = 'network::brocade::snmp::mode::components'; $self->{components_path} = 'network::brocade::snmp::mode::components';
$self->{components_module} = ['global', 'sensor']; $self->{components_module} = ['switch', 'sensor'];
} }
sub new { sub new {
@ -86,7 +86,7 @@ Check brocade operational status and hardware sensors (SW.mib).
=item B<--component> =item B<--component>
Which component to check (Default: '.*'). Which component to check (Default: '.*').
Can be: 'global', 'sensor'. Can be: 'switch', 'sensor'.
=item B<--filter> =item B<--filter>
@ -191,7 +191,7 @@ sub check {
1; 1;
package network::brocade::snmp::mode::components::global; package network::brocade::snmp::mode::components::switch;
use strict; use strict;
use warnings; use warnings;
@ -213,19 +213,19 @@ sub load {
sub check { sub check {
my ($self) = @_; my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking global"); $self->{output}->output_add(long_msg => "Checking switch");
$self->{components}->{global} = {name => 'global', total => 0, skip => 0}; $self->{components}->{switch} = {name => 'switch', total => 0, skip => 0};
return if ($self->check_filter(section => 'global')); return if ($self->check_filter(section => 'switch'));
my $result = $self->{snmp}->map_instance(mapping => $mapping_global, results => $self->{results}->{$oid_swSystem}, instance => '0'); my $result = $self->{snmp}->map_instance(mapping => $mapping_global, results => $self->{results}->{$oid_swSystem}, instance => '0');
return if (!defined($result->{swOperStatus})); return if (!defined($result->{swOperStatus}));
$self->{components}->{global}->{total}++; $self->{components}->{switch}->{total}++;
$self->{output}->output_add(long_msg => sprintf("switch operational status is '%s' [firmware: %s].", $self->{output}->output_add(long_msg => sprintf("switch operational status is '%s' [firmware: %s].",
$result->{swOperStatus}, $result->{swFirmwareVersion} $result->{swOperStatus}, $result->{swFirmwareVersion}
)); ));
my $exit = $self->get_severity(section => 'global', value => $result->{swOperStatus}); my $exit = $self->get_severity(section => 'switch', value => $result->{swOperStatus});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit, $self->{output}->output_add(severity => $exit,
short_msg => sprintf("switch operational status is '%s'", short_msg => sprintf("switch operational status is '%s'",