+ Add disk check for hardware proliant

This commit is contained in:
Quentin Garnier 2014-01-28 17:48:40 +01:00
parent 22d53e9015
commit e7504cf452
5 changed files with 1016 additions and 0 deletions

View File

@ -0,0 +1,397 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package hardware::server::hpproliant::mode::components::fca;
# In 'CPQFCA-MIB.mib'
my %conditions = (
1 => ['other', 'CRITICAL'],
2 => ['ok', 'OK'],
3 => ['degraded', 'WARNING'],
4 => ['failed', 'CRITICAL']
);
my %model_map = (
1 => 'other',
2 => 'fchc-p',
3 => 'fchc-e',
4 => 'fchc64',
5 => 'sa-sam',
6 => 'fca-2101',
7 => 'sw64-33',
8 => 'fca-221x',
9 => 'dpfcmc',
10 => 'fca-2404',
11 => 'fca-2214',
12 => 'a7298a',
13 => 'fca-2214dc',
14 => 'a6826a',
15 => 'fcmcG3',
16 => 'fcmcG4',
17 => 'ab46xa',
18 => 'fc-generic',
19 => 'fca-1143',
20 => 'fca-1243',
21 => 'fca-2143',
22 => 'fca-2243',
23 => 'fca-1050',
24 => 'fca-lpe1105',
25 => 'fca-qmh2462',
26 => 'fca-1142sr',
27 => 'fca-1242sr',
28 => 'fca-2142sr',
29 => 'fca-2242sr',
30 => 'fcmc20pe',
31 => 'fca-81q',
32 => 'fca-82q',
33 => 'fca-qmh2562',
34 => 'fca-81e',
35 => 'fca-82e',
36 => 'fca-1205',
);
my %hostctlstatus_map = (
1 => 'other',
2 => 'ok',
3 => 'failed',
4 => 'shutdown',
5 => 'loopDegraded',
6 => 'loopFailed',
7 => 'notConnected',
);
my %external_model_map = (
1 => 'other',
2 => 'fibreArray',
3 => 'msa1000',
4 => 'smartArrayClusterStorage',
5 => 'hsg80',
6 => 'hsv110',
7 => 'msa500G2',
8 => 'msa20',
9 => 'msa1510i',
);
my %externalctlstatus_map = (
1 => 'other',
2 => 'ok',
3 => 'failed',
4 => 'offline',
5 => 'redundantPathOffline',
6 => 'notConnected',
);
my %externalrole_map = (
1 => 'other',
2 => 'notDuplexed',
3 => 'active',
4 => 'backup',
);
my %accelstatus_map = (
1 => 'other',
2 => 'invalid',
3 => 'enabled',
4 => 'tmpDisabled',
5 => 'permDisabled',
);
my %conditionsbattery = (
1 => ['other', 'CRITICAL'],
2 => ['ok', 'OK'],
3 => ['recharging', 'WARNING'],
4 => ['failed', 'CRITICAL'],
5 => ['degraded', 'WARNING'],
6 => ['not present', 'OK'],
);
my %ldrive_fault_tolerance_map = (
1 => 'other',
2 => 'none',
3 => 'mirroring',
4 => 'dataGuard',
5 => 'distribDataGuard',
7 => 'advancedDataGuard',
);
my %ldrive_status_map = (
1 => 'other',
2 => 'ok',
3 => 'failed',
4 => 'unconfigured',
5 => 'recovering',
6 => 'readyForRebuild',
7 => 'rebuilding',
8 => 'wrongDrive',
9 => 'badConnect',
10 => 'overheating',
11 => 'shutdown',
12 => 'expanding',
13 => 'notAvailable',
14 => 'queuedForExpansion',
15 => 'hardError',
);
my %pdrive_status_map = (
1 => 'other',
2 => 'unconfigured',
3 => 'ok',
4 => 'threshExceeded',
5 => 'predictiveFailure',
6 => 'failed',
7 => 'unsupportedDrive',
);
sub host_array_controller {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking fca host controller");
$self->{components}->{fcahostctl} = {name => 'fca host controllers', total => 0};
return if ($self->check_exclude('fcahostctl'));
my $oid_cpqFcaHostCntlrIndex = '.1.3.6.1.4.1.232.16.2.7.1.1.1';
my $oid_cpqFcaHostCntlrSlot = '.1.3.6.1.4.1.232.16.2.7.1.1.2';
my $oid_cpqFcaHostCntlrStatus = '.1.3.6.1.4.1.232.16.2.7.1.1.4';
my $oid_cpqFcaHostCntlrModel = '.1.3.6.1.4.1.232.16.2.7.1.1.3';
my $oid_cpqFcaHostCntlrCondition = '.1.3.6.1.4.1.232.16.2.7.1.1.5';
my $result = $self->{snmp}->get_table(oid => $oid_cpqFcaHostCntlrIndex);
return if (scalar(keys %$result) <= 0);
$self->{snmp}->load(oids => [$oid_cpqFcaHostCntlrSlot, $oid_cpqFcaHostCntlrStatus,
$oid_cpqFcaHostCntlrCondition],
instances => [keys %$result]);
my $result2 = $self->{snmp}->get_leef();
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
$key =~ /(\d+)$/;
my $instance = $1;
my $fca_index = $1;
my $fca_status = $result2->{$oid_cpqFcaHostCntlrStatus . '.' . $instance};
my $fca_model = $result2->{$oid_cpqFcaHostCntlrModel . '.' . $instance};
my $fca_slot = $result2->{$oid_cpqFcaHostCntlrSlot . '.' . $instance};
my $fca_condition = $result2->{$oid_cpqFcaHostCntlrCondition . '.' . $instance};
$self->{components}->{fcahostctl}->{total}++;
$self->{output}->output_add(long_msg => sprintf("fca host controller %s [slot: %s, model: %s, status: %s] condition is %s.",
$fca_index, $fca_slot, $model_map{$fca_model}, $hostctlstatus_map{$fca_status},
${$conditions{$fca_condition}}[0]));
if (${$conditions{$fca_condition}}[1] ne 'OK') {
$self->{output}->output_add(severity => ${$conditions{$fca_condition}}[1],
short_msg => sprintf("fca host controller %s is %s",
$fca_index, ${$conditions{$fca_condition}}[0]));
}
}
}
sub external_array_controller {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking fca external controller");
$self->{components}->{fcaexternalctl} = {name => 'fca external controllers', total => 0};
return if ($self->check_exclude('fcaexternalctl'));
my $oid_cpqFcaCntlrCondition = '.1.3.6.1.4.1.232.16.2.2.1.1.6';
my $oid_cpqFcaCntlrModel = '.1.3.6.1.4.1.232.16.2.2.1.1.3';
my $oid_cpqFcaCntlrStatus = '.1.3.6.1.4.1.232.16.2.2.1.1.5';
my $oid_cpqFcaCntlrCurrentRole = '.1.3.6.1.4.1.232.16.2.2.1.1.10';
my $result = $self->{snmp}->get_table(oid => $oid_cpqFcaCntlrCondition);
return if (scalar(keys %$result) <= 0);
$self->{snmp}->load(oids => [$oid_cpqFcaCntlrModel, $oid_cpqFcaCntlrStatus,
$oid_cpqFcaCntlrCurrentRole],
instances => [keys %$result],
instance_regexp => '(\d+\.\d+)$');
my $result2 = $self->{snmp}->get_leef();
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
$key =~ /(\d+)\.(\d+)$/;
my $fca_box_index = $1;
my $fca_box_slot = $2;
my $instance = $1 . '.' . $2;
my $fca_status = $result2->{$oid_cpqFcaCntlrStatus . '.' . $instance};
my $fca_model = $result2->{$oid_cpqFcaCntlrModel . '.' . $instance};
my $fca_role = $result2->{$oid_cpqFcaCntlrCurrentRole . '.' . $instance};
my $fca_condition = $result->{$key};
$self->{components}->{fcaexternalctl}->{total}++;
$self->{output}->output_add(long_msg => sprintf("fca external controller %s [model: %s, status: %s, role: %s] condition is %s.",
$fca_box_index . ':' . $fca_box_slot,
$external_model_map{$fca_model}, $externalctlstatus_map{$fca_status}, $externalrole_map{$fca_role},
${$conditions{$fca_condition}}[0]));
if (${$conditions{$fca_condition}}[1] ne 'OK') {
$self->{output}->output_add(severity => ${$conditions{$fca_condition}}[1],
short_msg => sprintf("fca external controller %s is %s",
$fca_box_index . ':' . $fca_box_slot, ${$conditions{$fca_condition}}[0]));
}
}
}
sub external_array_accelerator {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking fca external accelerator boards");
$self->{components}->{fcaexternalacc} = {name => 'fca external accelerator boards', total => 0};
return if ($self->check_exclude('fcaexternalacc'));
my $oid_cpqFcaAccelCondition = '.1.3.6.1.4.1.232.16.2.2.2.1.9';
my $oid_cpqFcaAccelStatus = '.1.3.6.1.4.1.232.16.2.2.2.1.3';
my $oid_cpqFcaAccelBatteryStatus = '.1.3.6.1.4.1.232.16.2.2.2.1.6';
my $result = $self->{snmp}->get_table(oid => $oid_cpqFcaAccelCondition);
return if (scalar(keys %$result) <= 0);
$self->{snmp}->load(oids => [$oid_cpqFcaAccelStatus, $oid_cpqFcaAccelBatteryStatus],
instances => [keys %$result],
instance_regexp => '(\d+\.\d+)$');
my $result2 = $self->{snmp}->get_leef();
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
$key =~ /(\d+)\.(\d+)$/;
my $fca_box_index = $1;
my $fca_box_slot = $2;
my $instance = $1 . '.' . $2;
my $accel_status = $result2->{$oid_cpqFcaAccelStatus . '.' . $instance};
my $accel_condition = $result->{$key};
my $accel_battery = $result2->{$oid_cpqFcaAccelBatteryStatus . '.' . $instance};
$self->{components}->{fcaexternalacc}->{total}++;
$self->{output}->output_add(long_msg => sprintf("fca external accelerator boards %s [status: %s, battery status: %s] condition is %s.",
$fca_box_index . ':' . $fca_box_slot,
$accelstatus_map{$accel_status}, ${$conditionsbattery{$accel_battery}}[0],
${$conditions{$accel_condition}}[0]));
if (${$conditions{$accel_condition}}[1] ne 'OK') {
$self->{output}->output_add(severity => ${$conditions{$accel_condition}}[1],
short_msg => sprintf("fca external accelerator boards %s is %s",
$$fca_box_index . ':' . $fca_box_slot, ${$conditions{$accel_condition}}[0]));
}
if (${$conditionsbattery{$accel_battery}}[1] ne 'OK') {
$self->{output}->output_add(severity => ${$conditionsbattery{$accel_battery}}[1],
short_msg => sprintf("fca external accelerator boards %s battery is %s",
$fca_box_index . ':' . $fca_box_slot, ${$conditionsbattery{$accel_battery}}[0]));
}
}
}
sub logical_drive {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking fca logical drives");
$self->{components}->{fcaldrive} = {name => 'fca logical drives', total => 0};
return if ($self->check_exclude('fcaldrive'));
my $oid_cpqFcaLogDrvCondition = '.1.3.6.1.4.1.232.16.2.3.1.1.11';
my $oid_cpqFcaLogDrvStatus = '.1.3.6.1.4.1.232.16.2.3.1.1.4';
my $oid_cpqFcaLogDrvFaultTol = '.1.3.6.1.4.1.232.16.2.3.1.1.3';
my $result = $self->{snmp}->get_table(oid => $oid_cpqFcaLogDrvCondition);
return if (scalar(keys %$result) <= 0);
$self->{snmp}->load(oids => [$oid_cpqFcaLogDrvStatus,
$oid_cpqFcaLogDrvFaultTol],
instances => [keys %$result],
instance_regexp => '(\d+\.\d+)$');
my $result2 = $self->{snmp}->get_leef();
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
$key =~ /(\d+)\.(\d+)$/;
my $box_index = $1;
my $drive_index = $2;
my $instance = $1 . '.' . $2;
my $ldrive_status = $result2->{$oid_cpqFcaLogDrvStatus . '.' . $instance};
my $ldrive_condition = $result->{$key};
my $ldrive_faultol = $result2->{$oid_cpqFcaLogDrvFaultTol . '.' . $instance};
$self->{components}->{fcaldrive}->{total}++;
$self->{output}->output_add(long_msg => sprintf("fca logical drive %s [fault tolerance: %s, status: %s] condition is %s.",
$box_index . ':' . $drive_index,
$ldrive_fault_tolerance_map{$ldrive_faultol},
$ldrive_status_map{$ldrive_status},
${$conditions{$ldrive_condition}}[0]));
if (${$conditions{$ldrive_condition}}[1] ne 'OK') {
if ($ldrive_status_map{$ldrive_status} =~ /rebuild|recovering|expand/i) {
$self->{output}->output_add(severity => 'WARNING',
short_msg => sprintf("fca logical drive %s is %s",
$box_index . ':' . $drive_index, ${$conditions{$ldrive_condition}}[0]));
} else {
$self->{output}->output_add(severity => ${$conditions{$ldrive_condition}}[1],
short_msg => sprintf("fca logical drive %s is %s",
$box_index . ':' . $drive_index, ${$conditions{$ldrive_condition}}[0]));
}
}
}
}
sub physical_drive {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking fca physical drives");
$self->{components}->{fcapdrive} = {name => 'fca physical drives', total => 0};
return if ($self->check_exclude('fcapdrive'));
my $oid_cpqFcaPhyDrvCondition = '.1.3.6.1.4.1.232.16.2.5.1.1.31';
my $oid_cpqFcaPhyDrvStatus = '.1.3.6.1.4.1.232.16.2.5.1.1.6';
my $result = $self->{snmp}->get_table(oid => $oid_cpqFcaPhyDrvCondition);
return if (scalar(keys %$result) <= 0);
$self->{snmp}->load(oids => [$oid_cpqFcaPhyDrvStatus],
instances => [keys %$result],
instance_regexp => '(\d+\.\d+)$');
my $result2 = $self->{snmp}->get_leef();
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
$key =~ /(\d+)\.(\d+)$/;
my $box_index = $1;
my $drive_index = $2;
my $instance = $1 . '.' . $2;
my $pdrive_status = $result2->{$oid_cpqFcaPhyDrvStatus . '.' . $instance};
my $pdrive_condition = $result->{$key};
$self->{components}->{fcapdrive}->{total}++;
$self->{output}->output_add(long_msg => sprintf("fca physical drive %s [status: %s] condition is %s.",
$box_index . ':' . $drive_index,
$pdrive_status_map{$pdrive_status},
${$conditions{$pdrive_condition}}[0]));
if (${$conditions{$pdrive_condition}}[1] ne 'OK') {
$self->{output}->output_add(severity => ${$conditions{$pdrive_condition}}[1],
short_msg => sprintf("fca physical drive %s is %s",
$box_index . ':' . $drive_index, ${$conditions{$pdrive_condition}}[0]));
}
}
}
1;

View File

@ -0,0 +1,195 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package hardware::server::hpproliant::mode::components::ide;
use centreon::plugins::misc;
# In 'CPQIDE-MIB.mib'
my %controllerstatus_map = (
1 => 'other',
2 => 'ok',
3 => 'failed',
);
my %conditions = (
1 => ['other', 'CRITICAL'],
2 => ['ok', 'OK'],
3 => ['degraded', 'WARNING'],
4 => ['failed', 'CRITICAL']
);
my %ldrive_status_map = (
1 => 'other',
2 => 'ok',
3 => 'degraded',
4 => 'rebuilding',
5 => 'failed',
);
my %pdrive_status_map = (
1 => 'other',
2 => 'ok',
3 => 'smartError',
4 => 'failed',
);
sub controller {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking ide controllers");
$self->{components}->{idectl} = {name => 'ide controllers', total => 0};
return if ($self->check_exclude('idectl'));
my $oid_cpqIdeControllerIndex = '.1.3.6.1.4.1.232.14.2.3.1.1.1';
my $oid_cpqIdeControllerCondition = '.1.3.6.1.4.1.232.14.2.3.1.1.7';
my $oid_cpqIdeControllerModel = '.1.3.6.1.4.1.232.14.2.3.1.1.3';
my $oid_cpqIdeControllerSlot = '.1.3.6.1.4.1.232.14.2.3.1.1.5';
my $oid_cpqIdeControllerStatus = '.1.3.6.1.4.1.232.14.2.3.1.1.6';
my $result = $self->{snmp}->get_table(oid => $oid_cpqIdeControllerIndex);
return if (scalar(keys %$result) <= 0);
$self->{snmp}->load(oids => [$oid_cpqIdeControllerCondition, $oid_cpqIdeControllerModel,
$oid_cpqIdeControllerSlot, $oid_cpqIdeControllerStatus],
instances => [keys %$result]);
my $result2 = $self->{snmp}->get_leef();
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
$key =~ /(\d+)$/;
my $instance = $1;
my $ide_model = centreon::plugins::misc::trim($result2->{$oid_cpqIdeControllerModel . '.' . $instance});
my $ide_slot = $result2->{$oid_cpqIdeControllerSlot . '.' . $instance};
my $ide_condition = $result2->{$oid_cpqIdeControllerCondition . '.' . $instance};
my $ide_status = $result2->{$oid_cpqIdeControllerStatus . '.' . $instance};
$self->{components}->{idectl}->{total}++;
$self->{output}->output_add(long_msg => sprintf("ide controller %s [slot: %s, model: %s, status: %s] condition is %s.",
$instance, $ide_slot, $ide_model, $controllerstatus_map{$ide_status},
${$conditions{$ide_condition}}[0]));
if (${$conditions{$ide_condition}}[1] ne 'OK') {
$self->{output}->output_add(severity => ${$conditions{$ide_condition}}[1],
short_msg => sprintf("ide controller %d is %s",
$instance, ${$conditions{$ide_condition}}[0]));
}
}
}
sub logical_drive {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking ide logical drives");
$self->{components}->{ideldrive} = {name => 'ide logical drives', total => 0};
return if ($self->check_exclude('ideldrive'));
my $oid_cpqIdeLogicalDriveCondition = '.1.3.6.1.4.1.232.14.2.6.1.1.6';
my $oid_cpqIdeLogicalDriveStatus = '.1.3.6.1.4.1.232.14.2.6.1.1.5';
my $result = $self->{snmp}->get_table(oid => $oid_cpqIdeLogicalDriveCondition);
return if (scalar(keys %$result) <= 0);
$self->{snmp}->load(oids => [$oid_cpqIdeLogicalDriveStatus],
instances => [keys %$result],
instance_regexp => '(\d+\.\d+)$');
my $result2 = $self->{snmp}->get_leef();
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
$key =~ /(\d+)\.(\d+)$/;
my $controller_index = $1;
my $drive_index = $2;
my $instance = $1 . '.' . $2;
my $ldrive_status = $result2->{$oid_cpqIdeLogicalDriveStatus . '.' . $instance};
my $ldrive_condition = $result->{$key};
$self->{components}->{ideldrive}->{total}++;
$self->{output}->output_add(long_msg => sprintf("ide logical drive %s [status: %s] condition is %s.",
$controller_index . ':' . $drive_index,
$ldrive_status_map{$ldrive_status},
${$conditions{$ldrive_condition}}[0]));
if (${$conditions{$ldrive_condition}}[1] ne 'OK') {
if ($ldrive_status_map{$ldrive_status} =~ /rebuild/i) {
$self->{output}->output_add(severity => 'WARNING',
short_msg => sprintf("ide logical drive %s is %s",
$controller_index . ':' . $drive_index, ${$conditions{$ldrive_condition}}[0]));
} else {
$self->{output}->output_add(severity => ${$conditions{$ldrive_condition}}[1],
short_msg => sprintf("ide logical drive %s is %s",
$controller_index . ':' . $drive_index, ${$conditions{$ldrive_condition}}[0]));
}
}
}
}
sub physical_drive {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking ide physical drives");
$self->{components}->{idepdrive} = {name => 'ide physical drives', total => 0};
return if ($self->check_exclude('idepdrive'));
my $oid_cpqIdeAtaDiskCondition = '.1.3.6.1.4.1.232.14.2.4.1.1.7';
my $oid_cpqIdeAtaDiskStatus = '.1.3.6.1.4.1.232.14.2.4.1.1.6';
my $result = $self->{snmp}->get_table(oid => $oid_cpqIdeAtaDiskCondition);
return if (scalar(keys %$result) <= 0);
$self->{snmp}->load(oids => [$oid_cpqIdeAtaDiskStatus],
instances => [keys %$result],
instance_regexp => '(\d+\.\d+)$');
my $result2 = $self->{snmp}->get_leef();
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
$key =~ /(\d+)\.(\d+)$/;
my $controller_index = $1;
my $drive_index = $2;
my $instance = $1 . '.' . $2;
my $pdrive_status = $result2->{$oid_cpqIdeAtaDiskStatus . '.' . $instance};
my $pdrive_condition = $result->{$key};
$self->{components}->{idepdrive}->{total}++;
$self->{output}->output_add(long_msg => sprintf("ide physical drive %s [status: %s] condition is %s.",
$controller_index . ':' . $drive_index,
$pdrive_status_map{$pdrive_status},
${$conditions{$pdrive_condition}}[0]));
if (${$conditions{$pdrive_condition}}[1] ne 'OK') {
$self->{output}->output_add(severity => ${$conditions{$pdrive_condition}}[1],
short_msg => sprintf("ide physical drive %s is %s",
$controller_index . ':' . $drive_index, ${$conditions{$pdrive_condition}}[0]));
}
}
}
1;

View File

@ -0,0 +1,199 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package hardware::server::hpproliant::mode::components::sas;
use centreon::plugins::misc;
# In 'CPQSCSI-MIB.mib'
my %controllerstatus_map = (
1 => "other",
2 => "ok",
3 => "failed",
);
my %conditions = (
1 => ['other', 'CRITICAL'],
2 => ['ok', 'OK'],
3 => ['degraded', 'WARNING'],
4 => ['failed', 'CRITICAL']
);
my %ldrive_status_map = (
1 => "other",
2 => "ok",
3 => "degraded",
4 => "rebuilding",
5 => "failed",
6 => "offline",
);
my %pdrive_status_map = (
1 => "other",
2 => "ok",
3 => "predictiveFailure",
4 => "offline",
5 => "failed",
6 => "missingWasOk",
7 => "missingWasPredictiveFailure",
8 => "missingWasOffline",
9 => "missingWasFailed",
);
sub controller {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking sas controllers");
$self->{components}->{sasctl} = {name => 'sas controllers', total => 0};
return if ($self->check_exclude('sasctl'));
my $oid_cpqSasHbaIndex = '.1.3.6.1.4.1.232.5.5.1.1.1.1';
my $oid_cpqSasHbaCondition = '.1.3.6.1.4.1.232.5.5.1.1.1.5';
my $oid_cpqSasHbaSlot = '.1.3.6.1.4.1.232.5.5.1.1.1.6';
my $oid_cpqSasHbaStatus = '.1.3.6.1.4.1.232.5.5.1.1.1.4';
my $result = $self->{snmp}->get_table(oid => $oid_cpqSasHbaIndex);
return if (scalar(keys %$result) <= 0);
$self->{snmp}->load(oids => [$oid_cpqSasHbaCondition, $oid_cpqSasHbaSlot,
$oid_cpqSasHbaStatus],
instances => [keys %$result]);
my $result2 = $self->{snmp}->get_leef();
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
$key =~ /(\d+)$/;
my $instance = $1;
my $sas_slot = $result2->{$oid_cpqSasHbaSlot . '.' . $instance};
my $sas_condition = $result2->{$oid_cpqSasHbaCondition . '.' . $instance};
my $sas_status = $result2->{$oid_cpqSasHbaStatus . '.' . $instance};
$self->{components}->{sasctl}->{total}++;
$self->{output}->output_add(long_msg => sprintf("sas controller %s [slot: %s, status: %s] condition is %s.",
$instance, $sas_slot, $controllerstatus_map{$sas_status},
${$conditions{$sas_condition}}[0]));
if (${$conditions{$sas_condition}}[1] ne 'OK') {
$self->{output}->output_add(severity => ${$conditions{$sas_condition}}[1],
short_msg => sprintf("sas controller %d is %s",
$instance, ${$conditions{$sas_condition}}[0]));
}
}
}
sub logical_drive {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking sas logical drives");
$self->{components}->{sasldrive} = {name => 'sas logical drives', total => 0};
return if ($self->check_exclude('sasldrive'));
my $oid_cpqSasLogDrvCondition = '.1.3.6.1.4.1.232.5.5.3.1.1.5';
my $oid_cpqSasLogDrvStatusValue = '.1.3.6.1.4.1.232.5.5.3.1.1.4';
my $result = $self->{snmp}->get_table(oid => $oid_cpqSasLogDrvCondition);
return if (scalar(keys %$result) <= 0);
$self->{snmp}->load(oids => [$oid_cpqSasLogDrvStatusValue],
instances => [keys %$result],
instance_regexp => '(\d+\.\d+)$');
my $result2 = $self->{snmp}->get_leef();
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
$key =~ /(\d+)\.(\d+)$/;
my $controller_index = $1;
my $drive_index = $2;
my $instance = $1 . '.' . $2;
my $ldrive_status = $result2->{$oid_cpqSasLogDrvStatusValue . '.' . $instance};
my $ldrive_condition = $result->{$key};
$self->{components}->{sasldrive}->{total}++;
$self->{output}->output_add(long_msg => sprintf("sas logical drive %s [status: %s] condition is %s.",
$controller_index . ':' . $drive_index,
$ldrive_status_map{$ldrive_status},
${$conditions{$ldrive_condition}}[0]));
if (${$conditions{$ldrive_condition}}[1] ne 'OK') {
if ($ldrive_status_map{$ldrive_status} =~ /rebuild/i) {
$self->{output}->output_add(severity => 'WARNING',
short_msg => sprintf("sas logical drive %s is %s",
$controller_index . ':' . $drive_index, ${$conditions{$ldrive_condition}}[0]));
} else {
$self->{output}->output_add(severity => ${$conditions{$ldrive_condition}}[1],
short_msg => sprintf("sas logical drive %s is %s",
$controller_index . ':' . $drive_index, ${$conditions{$ldrive_condition}}[0]));
}
}
}
}
sub physical_drive {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking sas physical drives");
$self->{components}->{saspdrive} = {name => 'sas physical drives', total => 0};
return if ($self->check_exclude('saspdrive'));
my $oid_cpqSasPhyDrvCondition = '.1.3.6.1.4.1.232.5.5.2.1.1.6';
my $oid_cpqSasPhyDrvStatus = '.1.3.6.1.4.1.232.5.5.2.1.1.5';
my $result = $self->{snmp}->get_table(oid => $oid_cpqSasPhyDrvCondition);
return if (scalar(keys %$result) <= 0);
$self->{snmp}->load(oids => [$oid_cpqSasPhyDrvStatus],
instances => [keys %$result],
instance_regexp => '(\d+\.\d+)$');
my $result2 = $self->{snmp}->get_leef();
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
$key =~ /(\d+)\.(\d+)$/;
my $controller_index = $1;
my $drive_index = $2;
my $instance = $1 . '.' . $2;
my $pdrive_status = $result2->{$oid_cpqSasPhyDrvStatus . '.' . $instance};
my $pdrive_condition = $result->{$key};
$self->{components}->{saspdrive}->{total}++;
$self->{output}->output_add(long_msg => sprintf("sas physical drive %s [status: %s] condition is %s.",
$controller_index . ':' . $drive_index,
$pdrive_status_map{$pdrive_status},
${$conditions{$pdrive_condition}}[0]));
if (${$conditions{$pdrive_condition}}[1] ne 'OK') {
$self->{output}->output_add(severity => ${$conditions{$pdrive_condition}}[1],
short_msg => sprintf("sas physical drive %s is %s",
$controller_index . ':' . $drive_index, ${$conditions{$pdrive_condition}}[0]));
}
}
}
1;

View File

@ -0,0 +1,207 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package hardware::server::hpproliant::mode::components::scsi;
# In 'CPQSCSI-MIB.mib'
my %controllerstatus_map = (
1 => "other",
2 => "ok",
3 => "failed",
);
my %conditions = (
1 => ['other', 'CRITICAL'],
2 => ['ok', 'OK'],
3 => ['degraded', 'WARNING'],
4 => ['failed', 'CRITICAL']
);
my %ldrive_status_map = (
1 => 'other',
2 => 'ok',
3 => 'failed',
4 => 'unconfigured',
5 => 'recovering',
6 => 'readyForRebuild',
7 => 'rebuilding',
8 => 'wrongDrive',
9 => 'badConnect',
10 => 'degraded',
11 => 'disabled',
);
my %pdrive_status_map = (
1 => 'other',
2 => 'ok',
3 => 'failed',
4 => 'notConfigured',
5 => 'badCable',
6 => 'missingWasOk',
7 => 'missingWasFailed',
8 => 'predictiveFailure',
9 => 'missingWasPredictiveFailure',
10 => 'offline',
11 => 'missingWasOffline',
12 => 'hardError',
);
sub controller {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking scsi controllers");
$self->{components}->{scsictl} = {name => 'scsi controllers', total => 0};
return if ($self->check_exclude('scsictl'));
my $oid_cpqScsiCntlrCondition = '.1.3.6.1.4.1.232.5.2.2.1.1.12';
my $oid_cpqScsiCntlrSlot = '.1.3.6.1.4.1.232.5.2.2.1.1.6';
my $oid_cpqScsiCntlrStatus = '.1.3.6.1.4.1.232.5.2.2.1.1.7';
my $result = $self->{snmp}->get_table(oid => $oid_cpqScsiCntlrCondition);
return if (scalar(keys %$result) <= 0);
$self->{snmp}->load(oids => [$oid_cpqScsiCntlrSlot, $oid_cpqScsiCntlrStatus],
instances => [keys %$result],
instance_regexp => '(\d+\.\d+)$');
my $result2 = $self->{snmp}->get_leef();
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
$key =~ /(\d+)\.(\d+)$/;
my $controller_index = $1;
my $bus_index = $2;
my $instance = $1 . '.' . $2;
my $scsi_slot = $result2->{$oid_cpqScsiCntlrSlot . '.' . $instance};
my $scsi_condition = $result->{$key};
my $scsi_status = $result2->{$oid_cpqScsiCntlrStatus . '.' . $instance};
$self->{components}->{scsictl}->{total}++;
$self->{output}->output_add(long_msg => sprintf("scsi controller %s [slot: %s, status: %s] condition is %s.",
$controller_index . ':' . $bus_index, $scsi_slot, $controllerstatus_map{$scsi_status},
${$conditions{$scsi_condition}}[0]));
if (${$conditions{$scsi_condition}}[1] ne 'OK') {
$self->{output}->output_add(severity => ${$conditions{$scsi_condition}}[1],
short_msg => sprintf("scsi controller %d is %s",
$controller_index . ':' . $bus_index, ${$conditions{$scsi_condition}}[0]));
}
}
}
sub logical_drive {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking scsi logical drives");
$self->{components}->{scsildrive} = {name => 'scsi logical drives', total => 0};
return if ($self->check_exclude('scsildrive'));
my $oid_cpqScsiLogDrvCondition = '.1.3.6.1.4.1.232.5.2.3.1.1.8';
my $oid_cpqScsiLogDrvStatus = '.1.3.6.1.4.1.232.5.2.3.1.1.5';
my $result = $self->{snmp}->get_table(oid => $oid_cpqScsiLogDrvCondition);
return if (scalar(keys %$result) <= 0);
$self->{snmp}->load(oids => [$oid_cpqScsiLogDrvStatus],
instances => [keys %$result],
instance_regexp => '(\d+\.\d+\.\d+)$');
my $result2 = $self->{snmp}->get_leef();
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
$key =~ /(\d+)\.(\d+)\.(\d+)$/;
my $controller_index = $1;
my $bus_index = $2;
my $drive_index = $3;
my $instance = $1 . '.' . $2 . '.' . $3;
my $ldrive_status = $result2->{$oid_cpqScsiLogDrvStatus . '.' . $instance};
my $ldrive_condition = $result->{$key};
$self->{components}->{scsildrive}->{total}++;
$self->{output}->output_add(long_msg => sprintf("scsi logical drive %s [status: %s] condition is %s.",
$controller_index . ':' . $bus_index . ':' . $drive_index,
$ldrive_status_map{$ldrive_status},
${$conditions{$ldrive_condition}}[0]));
if (${$conditions{$ldrive_condition}}[1] ne 'OK') {
if ($ldrive_status_map{$ldrive_status} =~ /rebuild|recovering/i) {
$self->{output}->output_add(severity => 'WARNING',
short_msg => sprintf("scsi logical drive %s is %s",
$controller_index . ':' . $bus_index . ':' . $drive_index, ${$conditions{$ldrive_condition}}[0]));
} else {
$self->{output}->output_add(severity => ${$conditions{$ldrive_condition}}[1],
short_msg => sprintf("scsi logical drive %s is %s",
$controller_index . ':' . $bus_index . ':' . $drive_index, ${$conditions{$ldrive_condition}}[0]));
}
}
}
}
sub physical_drive {
my ($self) = @_;
$self->{output}->output_add(long_msg => "Checking scsi physical drives");
$self->{components}->{scsipdrive} = {name => 'scsi physical drives', total => 0};
return if ($self->check_exclude('scsipdrive'));
my $oid_cpqScsiPhyDrvCondition = '.1.3.6.1.4.1.232.5.2.4.1.1.26';
my $oid_cpqScsiPhyDrvStatus = '.1.3.6.1.4.1.232.5.2.4.1.1.9';
my $result = $self->{snmp}->get_table(oid => $oid_cpqScsiPhyDrvCondition);
return if (scalar(keys %$result) <= 0);
$self->{snmp}->load(oids => [$oid_cpqScsiPhyDrvStatus],
instances => [keys %$result],
instance_regexp => '(\d+\.\d+\.\d+)$');
my $result2 = $self->{snmp}->get_leef();
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
$key =~ /(\d+)\.(\d+)\.(\d+)$/;
my $controller_index = $1;
my $bus_index = $2;
my $drive_index = $3;
my $instance = $1 . '.' . $2 . '.' . $3;
my $pdrive_status = $result2->{$oid_cpqScsiPhyDrvStatus . '.' . $instance};
my $pdrive_condition = $result->{$key};
$self->{components}->{scsipdrive}->{total}++;
$self->{output}->output_add(long_msg => sprintf("scsi physical drive %s [status: %s] condition is %s.",
$controller_index . ':' . $bus_index . ':' . $drive_index,
$pdrive_status_map{$pdrive_status},
${$conditions{$pdrive_condition}}[0]));
if (${$conditions{$pdrive_condition}}[1] ne 'OK') {
$self->{output}->output_add(severity => ${$conditions{$pdrive_condition}}[1],
short_msg => sprintf("scsi physical drive %s is %s",
$controller_index . ':' . $bus_index . ':' . $drive_index, ${$conditions{$pdrive_condition}}[0]));
}
}
}
1;

View File

@ -47,6 +47,10 @@ use hardware::server::hpproliant::mode::components::fan;
use hardware::server::hpproliant::mode::components::temperature; use hardware::server::hpproliant::mode::components::temperature;
use hardware::server::hpproliant::mode::components::network; use hardware::server::hpproliant::mode::components::network;
use hardware::server::hpproliant::mode::components::ida; use hardware::server::hpproliant::mode::components::ida;
use hardware::server::hpproliant::mode::components::fca;
use hardware::server::hpproliant::mode::components::ide;
use hardware::server::hpproliant::mode::components::sas;
use hardware::server::hpproliant::mode::components::scsi;
sub new { sub new {
my ($class, %options) = @_; my ($class, %options) = @_;
@ -88,6 +92,20 @@ sub run {
hardware::server::hpproliant::mode::components::ida::array_accelerator($self); hardware::server::hpproliant::mode::components::ida::array_accelerator($self);
hardware::server::hpproliant::mode::components::ida::logical_drive($self); hardware::server::hpproliant::mode::components::ida::logical_drive($self);
hardware::server::hpproliant::mode::components::ida::physical_drive($self); hardware::server::hpproliant::mode::components::ida::physical_drive($self);
hardware::server::hpproliant::mode::components::fca::host_array_controller($self);
hardware::server::hpproliant::mode::components::fca::external_array_controller($self);
hardware::server::hpproliant::mode::components::fca::external_array_accelerator($self);
hardware::server::hpproliant::mode::components::fca::logical_drive($self);
hardware::server::hpproliant::mode::components::fca::physical_drive($self);
hardware::server::hpproliant::mode::components::ide::controller($self);
hardware::server::hpproliant::mode::components::ide::logical_drive($self);
hardware::server::hpproliant::mode::components::ide::physical_drive($self);
hardware::server::hpproliant::mode::components::sas::controller($self);
hardware::server::hpproliant::mode::components::sas::logical_drive($self);
hardware::server::hpproliant::mode::components::sas::physical_drive($self);
hardware::server::hpproliant::mode::components::scsi::controller($self);
hardware::server::hpproliant::mode::components::scsi::logical_drive($self);
hardware::server::hpproliant::mode::components::scsi::physical_drive($self);
my $total_components = 0; my $total_components = 0;
my $display_by_component = ''; my $display_by_component = '';