mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-04-07 20:35:27 +02:00
+ Fix #336
This commit is contained in:
parent
5dbbca18b4
commit
a8b977b875
@ -0,0 +1,77 @@
|
||||
#
|
||||
# Copyright 2017 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package network::checkpoint::snmp::mode::components::raiddisk;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
my %map_states_disk = (
|
||||
0 => 'online',
|
||||
1 => 'missing',
|
||||
2 => 'not_compatible',
|
||||
3 => 'failed',
|
||||
4 => 'initializing',
|
||||
5 => 'offline_requested',
|
||||
6 => 'failed_requested',
|
||||
255 => 'other_offline',
|
||||
);
|
||||
|
||||
my $mapping = {
|
||||
raidDiskProductID => { oid => '.1.3.6.1.4.1.2620.1.6.7.7.2.1.6' },
|
||||
raidDiskSyncState => { oid => '.1.3.6.1.4.1.2620.1.6.7.7.2.1.11', map => \%map_states_disk },
|
||||
};
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $mapping->{raidDiskProductID}->{oid} },
|
||||
{ oid => $mapping->{raidDiskSyncState}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking raid disks");
|
||||
$self->{components}->{raiddisk} = {name => 'raiddisk', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'raiddisk'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{raidDiskProductID}->{oid}}})) {
|
||||
$oid =~ /^$mapping->{raidDiskProductID}->{oid}\.(.*)$/;
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{raidDiskSyncState}->{oid}}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'raiddisk', instance => $instance));
|
||||
|
||||
my $name = centreon::plugins::misc::trim($self->{results}->{$mapping->{raidDiskProductID}->{oid}}->{$oid});
|
||||
$self->{components}->{raiddisk}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("raid disk '%s' status is '%s'",
|
||||
$name, $result->{raidDiskSyncState}));
|
||||
my $exit = $self->get_severity(section => 'raiddisk', value => $result->{raidDiskSyncState});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Raid disk '%s' status is '%s'",
|
||||
$name, $result->{raidDiskSyncState}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
@ -28,7 +28,7 @@ use warnings;
|
||||
sub set_system {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{regexp_threshold_overload_check_section_option} = '^(temperature|voltage|fan|psu)$';
|
||||
$self->{regexp_threshold_overload_check_section_option} = '^(temperature|voltage|fan|psu|raiddisk)$';
|
||||
|
||||
$self->{cb_hook2} = 'snmp_execute';
|
||||
|
||||
@ -52,11 +52,22 @@ sub set_system {
|
||||
['up', 'OK'],
|
||||
['down', 'CRITICAL'],
|
||||
['.*', 'UNKNOWN'],
|
||||
],
|
||||
raiddisk => [
|
||||
['online', 'OK'],
|
||||
['missing', 'OK'],
|
||||
['not_compatible', 'CRITICAL'],
|
||||
['failed', 'CRITICAL'],
|
||||
['initializing', 'OK'],
|
||||
['offline_requested', 'OK'],
|
||||
['failed_requested', 'OK'],
|
||||
['other_offline', 'WARNING'],
|
||||
['.*', 'UNKNOWN'],
|
||||
],
|
||||
};
|
||||
|
||||
$self->{components_path} = 'network::checkpoint::snmp::mode::components';
|
||||
$self->{components_module} = ['voltage', 'fan', 'temperature', 'psu'];
|
||||
$self->{components_module} = ['voltage', 'fan', 'temperature', 'psu', 'raiddisk'];
|
||||
}
|
||||
|
||||
sub snmp_execute {
|
||||
@ -92,7 +103,7 @@ Check hardware (fans, power supplies, temperatures, voltages).
|
||||
=item B<--component>
|
||||
|
||||
Which component to check (Default: '.*').
|
||||
Can be: 'psu', 'fan', 'temperature', 'voltage'.
|
||||
Can be: 'psu', 'fan', 'temperature', 'voltage', 'raiddisk'.
|
||||
|
||||
=item B<--filter>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user