+ Refactoring hp proliant plugin (could add single service check also now)
This commit is contained in:
parent
afa2163e92
commit
0865ca4e95
|
@ -0,0 +1,88 @@
|
|||
################################################################################
|
||||
# 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::cpu;
|
||||
|
||||
my %cpustatus = (
|
||||
1 => ['unknown', 'UNKNOWN'],
|
||||
2 => ['ok', 'OK'],
|
||||
3 => ['degraded', 'WARNING'],
|
||||
4 => ['failed', 'CRITICAL'],
|
||||
5 => ['disabled', 'OK']
|
||||
);
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
# In MIB 'CPQSTDEQ-MIB.mib'
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking cpu");
|
||||
$self->{components}->{cpu} = {name => 'cpus', total => 0};
|
||||
return if ($self->check_exclude('cpu'));
|
||||
|
||||
my $oid_cpqSeCpuUnitIndex = '.1.3.6.1.4.1.232.1.2.2.1.1.1';
|
||||
my $oid_cpqSeCpuSlot = '.1.3.6.1.4.1.232.1.2.2.1.1.2';
|
||||
my $oid_cpqSeCpuName = '.1.3.6.1.4.1.232.1.2.2.1.1.3';
|
||||
my $oid_cpqSeCpuStatus = '.1.3.6.1.4.1.232.1.2.2.1.1.6';
|
||||
my $oid_cpqSeCpuSocketNumber = '.1.3.6.1.4.1.232.1.2.2.1.1.9';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqSeCpuUnitIndex);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$oid_cpqSeCpuSlot, $oid_cpqSeCpuName,
|
||||
$oid_cpqSeCpuStatus, $oid_cpqSeCpuSocketNumber],
|
||||
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 $cpu_slot = $result2->{$oid_cpqSeCpuSlot . '.' . $instance};
|
||||
my $cpu_name = $result2->{$oid_cpqSeCpuName . '.' . $instance};
|
||||
my $cpu_status = $result2->{$oid_cpqSeCpuStatus . '.' . $instance};
|
||||
my $cpu_socket_number = $result2->{$oid_cpqSeCpuSocketNumber . '.' . $instance};
|
||||
|
||||
$self->{components}->{cpu}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("cpu [slot: %s, unit: %s, name: %s, socket: %s] status is %s.",
|
||||
$cpu_slot, $result->{$key}, $cpu_name, $cpu_socket_number,
|
||||
${$cpustatus{$cpu_status}}[0]));
|
||||
if (${$cpustatus{$cpu_status}}[1] ne 'OK') {
|
||||
$self->{output}->output_add(severity => ${$cpustatus{$cpu_status}}[1],
|
||||
short_msg => sprintf("cpu %d is %s",
|
||||
$result->{$key}, ${$cpustatus{$cpu_status}}[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,135 @@
|
|||
################################################################################
|
||||
# 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::fan;
|
||||
|
||||
my %conditions = (
|
||||
1 => ['other', 'CRITICAL'],
|
||||
2 => ['ok', 'OK'],
|
||||
3 => ['degraded', 'WARNING'],
|
||||
4 => ['failed', 'CRITICAL']
|
||||
);
|
||||
|
||||
my %redundant_map = (
|
||||
1 => 'other',
|
||||
2 => 'not redundant',
|
||||
3 => 'redundant',
|
||||
);
|
||||
|
||||
my %location_map = (
|
||||
1 => "other",
|
||||
2 => "unknown",
|
||||
3 => "system",
|
||||
4 => "systemBoard",
|
||||
5 => "ioBoard",
|
||||
6 => "cpu",
|
||||
7 => "memory",
|
||||
8 => "storage",
|
||||
9 => "removableMedia",
|
||||
10 => "powerSupply",
|
||||
11 => "ambient",
|
||||
12 => "chassis",
|
||||
13 => "bridgeCard",
|
||||
);
|
||||
|
||||
my %fanspeed = (
|
||||
1 => "other",
|
||||
2 => "normal",
|
||||
3 => "high",
|
||||
);
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
# In MIB 'CPQHLTH-MIB.mib'
|
||||
$self->{output}->output_add(long_msg => "Checking fans");
|
||||
$self->{components}->{fan} = {name => 'fans', total => 0};
|
||||
return if ($self->check_exclude('fan'));
|
||||
|
||||
my $oid_cpqHeFltTolFanPresent = '.1.3.6.1.4.1.232.6.2.6.7.1.4';
|
||||
my $oid_cpqHeFltTolFanChassis = '.1.3.6.1.4.1.232.6.2.6.7.1.1';
|
||||
my $oid_cpqHeFltTolFanIndex = '.1.3.6.1.4.1.232.6.2.6.7.1.2';
|
||||
my $oid_cpqHeFltTolFanLocale = '.1.3.6.1.4.1.232.6.2.6.7.1.3';
|
||||
my $oid_cpqHeFltTolFanCondition = '.1.3.6.1.4.1.232.6.2.6.7.1.9';
|
||||
my $oid_cpqHeFltTolFanSpeed = '.1.3.6.1.4.1.232.6.2.6.7.1.6';
|
||||
my $oid_cpqHeFltTolFanCurrentSpeed = '.1.3.6.1.4.1.232.6.2.6.7.1.12';
|
||||
my $oid_cpqHeFltTolFanRedundant = '.1.3.6.1.4.1.232.6.2.6.7.1.7';
|
||||
my $oid_cpqHeFltTolFanRedundantPartner = '.1.3.6.1.4.1.232.6.2.6.7.1.8';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqHeFltTolFanPresent);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
my @get_oids = ();
|
||||
my @oids_end = ();
|
||||
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
|
||||
next if ($present_map{$result->{$key}} ne 'present');
|
||||
# Chassis + index
|
||||
$key =~ /(\d+\.\d+)$/;
|
||||
my $oid_end = $1;
|
||||
|
||||
push @oids_end, $oid_end;
|
||||
push @get_oids, $oid_cpqHeFltTolFanLocale . "." . $oid_end, $oid_cpqHeFltTolFanCondition . "." . $oid_end,
|
||||
$oid_cpqHeFltTolFanCurrentSpeed . "." . $oid_end, $oid_cpqHeFltTolFanSpeed . "." . $oid_end,
|
||||
$oid_cpqHeFltTolFanRedundant . "." . $oid_end, $oid_cpqHeFltTolFanRedundantPartner . "." . $oid_end;
|
||||
}
|
||||
$result = $self->{snmp}->get_leef(oids => \@get_oids);
|
||||
foreach (@oids_end) {
|
||||
my ($fan_chassis, $fan_index) = split /\./;
|
||||
my $fan_locale = $result->{$oid_cpqHeFltTolFanLocale . '.' . $_};
|
||||
my $fan_condition = $result->{$oid_cpqHeFltTolFanCondition . '.' . $_};
|
||||
my $fan_speed = $result->{$oid_cpqHeFltTolFanSpeed . '.' . $_};
|
||||
my $fan_currentspeed = $result->{$oid_cpqHeFltTolFanCurrentSpeed . '.' . $_};
|
||||
my $fan_redundant = $result->{$oid_cpqHeFltTolFanRedundant . '.' . $_};
|
||||
my $fan_redundantpartner = $result->{$oid_cpqHeFltTolFanRedundantPartner . '.' . $_};
|
||||
|
||||
$self->{components}->{fan}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("fan %d status is %s, speed is %s [chassis: %s, location: %s, redundance: %s, redundant partner: %s].",
|
||||
$fan_index, ${$conditions{$fan_condition}}[0], $fanspeed{$fan_speed},
|
||||
$fan_chassis, $location_map{$fan_locale},
|
||||
$redundant_map{$fan_redundant}, $fan_redundantpartner
|
||||
));
|
||||
if ($fan_condition != 2) {
|
||||
$self->{output}->output_add(severity => ${$conditions{$fan_condition}}[1],
|
||||
short_msg => sprintf("fan %d status is %s",
|
||||
$fan_index, ${$conditions{$fan_condition}}[0]));
|
||||
}
|
||||
|
||||
if (defined($fan_currentspeed)) {
|
||||
$self->{output}->perfdata_add(label => "fan_" . $fan_index . "_speed", unit => 'rpm',
|
||||
value => $fan_currentspeed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,320 @@
|
|||
################################################################################
|
||||
# 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::ida;
|
||||
# In 'CPQIDA-MIB.mib'
|
||||
|
||||
my %model_map = (
|
||||
1 => 'other',
|
||||
2 => 'ida',
|
||||
3 => 'idaExpansion',
|
||||
4 => 'ida-2',
|
||||
5 => 'smart',
|
||||
6 => 'smart-2e',
|
||||
7 => 'smart-2p',
|
||||
8 => 'smart-2sl',
|
||||
9 => 'smart-3100es',
|
||||
10 => 'smart-3200',
|
||||
11 => 'smart-2dh',
|
||||
12 => 'smart-221',
|
||||
13 => 'sa-4250es',
|
||||
14 => 'sa-4200',
|
||||
15 => 'sa-integrated',
|
||||
16 => 'sa-431',
|
||||
17 => 'sa-5300',
|
||||
18 => 'raidLc2',
|
||||
19 => 'sa-5i',
|
||||
20 => 'sa-532',
|
||||
21 => 'sa-5312',
|
||||
22 => 'sa-641',
|
||||
23 => 'sa-642',
|
||||
24 => 'sa-6400',
|
||||
25 => 'sa-6400em',
|
||||
26 => 'sa-6i',
|
||||
27 => 'sa-generic',
|
||||
29 => 'sa-p600',
|
||||
30 => 'sa-p400',
|
||||
31 => 'sa-e200',
|
||||
32 => 'sa-e200i',
|
||||
33 => 'sa-p400i',
|
||||
34 => 'sa-p800',
|
||||
35 => 'sa-e500',
|
||||
36 => 'sa-p700m',
|
||||
37 => 'sa-p212',
|
||||
38 => 'sa-p410(38)',
|
||||
39 => 'sa-p410i',
|
||||
40 => 'sa-p411',
|
||||
41 => 'sa-b110i',
|
||||
42 => 'sa-p712m',
|
||||
43 => 'sa-p711m',
|
||||
44 => 'sa-p812'
|
||||
);
|
||||
|
||||
my %conditions = (
|
||||
1 => ['other', 'CRITICAL'],
|
||||
2 => ['ok', 'OK'],
|
||||
3 => ['degraded', 'WARNING'],
|
||||
4 => ['failed', 'CRITICAL']
|
||||
);
|
||||
|
||||
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',
|
||||
8 => 'raid50',
|
||||
9 => 'raid60',
|
||||
);
|
||||
|
||||
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 => 'multipathAccessDegraded',
|
||||
16 => 'erasing'
|
||||
);
|
||||
|
||||
my %pdrive_status_map = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'failed',
|
||||
4 => 'predictiveFailure',
|
||||
5 => 'erasing',
|
||||
6 => 'eraseDone',
|
||||
7 => 'eraseQueued',
|
||||
);
|
||||
|
||||
sub array_controller {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking da controller");
|
||||
$self->{components}->{dactl} = {name => 'da controllers', total => 0};
|
||||
return if ($self->check_exclude('dactl'));
|
||||
|
||||
my $oid_cpqDaCntlrIndex = '.1.3.6.1.4.1.232.3.2.2.1.1.1';
|
||||
my $oid_cpqDaCntlrModel = '.1.3.6.1.4.1.232.3.2.2.1.1.2';
|
||||
my $oid_cpqDaCntlrSlot = '.1.3.6.1.4.1.232.3.2.2.1.1.5';
|
||||
my $oid_cpqDaCntlrCondition = '.1.3.6.1.4.1.232.3.2.2.1.1.6';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqDaCntlrIndex);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$oid_cpqDaCntlrModel, $oid_cpqDaCntlrSlot,
|
||||
$oid_cpqDaCntlrCondition],
|
||||
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 $da_model = $result2->{$oid_cpqDaCntlrModel . '.' . $instance};
|
||||
my $da_slot = $result2->{$oid_cpqDaCntlrSlot . '.' . $instance};
|
||||
my $da_condition = $result2->{$oid_cpqDaCntlrCondition . '.' . $instance};
|
||||
|
||||
$self->{components}->{dactl}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("da controller %s [slot: %s, model: %s] status is %s.",
|
||||
$instance, $da_slot, $model_map{$da_model},
|
||||
${$conditions{$da_condition}}[0]));
|
||||
if (${$conditions{$da_condition}}[1] ne 'OK') {
|
||||
$self->{output}->output_add(severity => ${$conditions{$da_condition}}[1],
|
||||
short_msg => sprintf("da controller %d is %s",
|
||||
$instance, ${$conditions{$da_condition}}[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub array_accelerator {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking da accelerator boards");
|
||||
$self->{components}->{daacc} = {name => 'da accelerator boards', total => 0};
|
||||
return if ($self->check_exclude('daacc'));
|
||||
|
||||
my $oid_cpqDaAccelCntlrIndex = '.1.3.6.1.4.1.232.3.2.2.2.1.1';
|
||||
my $oid_cpqDaAccelStatus = '.1.3.6.1.4.1.232.3.2.2.2.1.2';
|
||||
my $oid_cpqDaAccelCondition = '.1.3.6.1.4.1.232.3.2.2.2.1.9';
|
||||
my $oid_cpqDaAccelBattery = '.1.3.6.1.4.1.232.3.2.2.2.1.6';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqDaAccelCntlrIndex);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$oid_cpqDaAccelStatus, $oid_cpqDaAccelCondition,
|
||||
$oid_cpqDaAccelBattery],
|
||||
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 $accel_status = $result2->{$oid_cpqDaAccelStatus . '.' . $instance};
|
||||
my $accel_condition = $result2->{$oid_cpqDaAccelCondition . '.' . $instance};
|
||||
my $accel_battery = $result2->{$oid_cpqDaAccelBattery . '.' . $instance};
|
||||
|
||||
$self->{components}->{daacc}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("da controller accelerator %s [status: %s, battery status: %s] condition is %s.",
|
||||
$instance, $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("da controller accelerator %d is %s",
|
||||
$instance, ${$conditions{$accel_condition}}[0]));
|
||||
}
|
||||
if (${$conditionsbattery{$accel_battery}}[1] ne 'OK') {
|
||||
$self->{output}->output_add(severity => ${$conditionsbattery{$accel_battery}}[1],
|
||||
short_msg => sprintf("da controller accelerator %d battery is %s",
|
||||
$instance, ${$conditionsbattery{$accel_battery}}[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub logical_drive {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking da logical drives");
|
||||
$self->{components}->{daldrive} = {name => 'da logical drives', total => 0};
|
||||
return if ($self->check_exclude('daldrive'));
|
||||
|
||||
my $oid_cpqDaLogDrvCondition = '.1.3.6.1.4.1.232.3.2.3.1.1.11';
|
||||
my $oid_cpqDaLogDrvStatus = '.1.3.6.1.4.1.232.3.2.3.1.1.4';
|
||||
my $oid_cpqDaLogDrvFaultTol = '.1.3.6.1.4.1.232.3.2.3.1.1.3';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqDaLogDrvCondition);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$oid_cpqDaLogDrvStatus,
|
||||
$oid_cpqDaLogDrvFaultTol],
|
||||
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_cpqDaLogDrvStatus . '.' . $instance};
|
||||
my $ldrive_condition = $result->{$key};
|
||||
my $ldrive_faultol = $result2->{$oid_cpqDaLogDrvFaultTol . '.' . $instance};
|
||||
|
||||
$self->{components}->{daldrive}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("da logical drive %s [fault tolerance: %s, status: %s] condition is %s.",
|
||||
$controller_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|recovery|expanding|queued/i) {
|
||||
$self->{output}->output_add(severity => 'WARNING',
|
||||
short_msg => sprintf("da 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("da 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 da physical drives");
|
||||
$self->{components}->{dapdrive} = {name => 'da physical drives', total => 0};
|
||||
return if ($self->check_exclude('dapdrive'));
|
||||
|
||||
my $oid_cpqDaPhyDrvCondition = '.1.3.6.1.4.1.232.3.2.5.1.1.37';
|
||||
my $oid_cpqDaPhyDrvStatus = '.1.3.6.1.4.1.232.3.2.5.1.1.6';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqDaPhyDrvCondition);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$oid_cpqDaPhyDrvStatus],
|
||||
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_cpqDaPhyDrvStatus . '.' . $instance};
|
||||
my $pdrive_condition = $result->{$key};
|
||||
|
||||
$self->{components}->{dapdrive}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("da 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("da physical drive %s is %s",
|
||||
$controller_index . ':' . $drive_index, ${$conditions{$pdrive_condition}}[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,175 @@
|
|||
################################################################################
|
||||
# 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::network;
|
||||
|
||||
my %conditions = (
|
||||
1 => ['other', 'CRITICAL'],
|
||||
2 => ['ok', 'OK'],
|
||||
3 => ['degraded', 'WARNING'],
|
||||
4 => ['failed', 'CRITICAL']
|
||||
);
|
||||
|
||||
my %map_pnic_role = (
|
||||
1 => "unknown",
|
||||
2 => "primary",
|
||||
3 => "secondary",
|
||||
4 => "member",
|
||||
5 => "txRx",
|
||||
6 => "tx",
|
||||
7 => "standby",
|
||||
8 => "none",
|
||||
255 => "notApplicable",
|
||||
);
|
||||
my %map_nic_state = (
|
||||
1 => "unknown",
|
||||
2 => "ok",
|
||||
3 => "standby",
|
||||
4 => "failed",
|
||||
);
|
||||
my %map_pnic_status = (
|
||||
1 => "unknown",
|
||||
2 => "ok",
|
||||
3 => "generalFailure",
|
||||
4 => "linkFailure",
|
||||
);
|
||||
my %map_lnic_status = (
|
||||
1 => "unknown",
|
||||
2 => "ok",
|
||||
3 => "primaryFailed",
|
||||
4 => "standbyFailed",
|
||||
5 => "groupFailed",
|
||||
6 => "redundancyReduced",
|
||||
7 => "redundancyLost",
|
||||
);
|
||||
my %map_nic_duplex = (
|
||||
1 => "unknown",
|
||||
2 => "half",
|
||||
3 => "full",
|
||||
);
|
||||
|
||||
sub physical_nic {
|
||||
my ($self) = @_;
|
||||
# In MIB 'CPQNIC-MIB.mib'
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking physical nics");
|
||||
$self->{components}->{pnic} = {name => 'physical nics', total => 0};
|
||||
return if ($self->check_exclude('pnic'));
|
||||
|
||||
my $oid_cpqNicIfPhysAdapterIndex = '.1.3.6.1.4.1.232.18.2.3.1.1.1';
|
||||
my $oid_cpqNicIfPhysAdapterRole = '.1.3.6.1.4.1.232.18.2.3.1.1.3';
|
||||
my $oid_cpqNicIfPhysAdapterCondition = '.1.3.6.1.4.1.232.18.2.3.1.1.12';
|
||||
my $oid_cpqNicIfPhysAdapterState = '.1.3.6.1.4.1.232.18.2.3.1.1.13';
|
||||
my $oid_cpqNicIfPhysAdapterStatus = '.1.3.6.1.4.1.232.18.2.3.1.1.14';
|
||||
my $oid_cpqNicIfPhysAdapterDuplexState = '.1.3.6.1.4.1.232.18.2.3.1.1.11';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqNicIfPhysAdapterIndex);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$oid_cpqNicIfPhysAdapterRole, $oid_cpqNicIfPhysAdapterCondition,
|
||||
$oid_cpqNicIfPhysAdapterState, $oid_cpqNicIfPhysAdapterStatus,
|
||||
$oid_cpqNicIfPhysAdapterDuplexState],
|
||||
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 $nic_index = $result->{$key};
|
||||
my $nic_role = $result2->{$oid_cpqNicIfPhysAdapterRole . '.' . $instance};
|
||||
my $nic_condition = $result2->{$oid_cpqNicIfPhysAdapterCondition . '.' . $instance};
|
||||
my $nic_state = $result2->{$oid_cpqNicIfPhysAdapterState . '.' . $instance};
|
||||
my $nic_status = $result2->{$oid_cpqNicIfPhysAdapterStatus . '.' . $instance};
|
||||
my $nic_duplex = $result2->{$oid_cpqNicIfPhysAdapterDuplexState . '.' . $instance};
|
||||
|
||||
$self->{components}->{pnic}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("physical nic %s [duplex: %s, role: %s, state: %s, status: %s] condition is %s.",
|
||||
$nic_index, $map_nic_duplex{$nic_duplex}, $map_pnic_role{$nic_role},
|
||||
$map_nic_state{$nic_state}, $map_pnic_status{$nic_status},
|
||||
${$conditions{$nic_condition}}[0]));
|
||||
if (${$conditions{$nic_condition}}[1] ne 'OK') {
|
||||
$self->{output}->output_add(severity => ${$conditions{$nic_condition}}[1],
|
||||
short_msg => sprintf("physical nic %d is %s",
|
||||
$nic_index, ${$conditions{$nic_condition}}[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub logical_nic {
|
||||
my ($self) = @_;
|
||||
# In MIB 'CPQNIC-MIB.mib'
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking logical nics");
|
||||
$self->{components}->{lnic} = {name => 'logical nics', total => 0};
|
||||
return if ($self->check_exclude('lnic'));
|
||||
|
||||
my $oid_cpqNicIfLogMapIndex = '.1.3.6.1.4.1.232.18.2.2.1.1.1';
|
||||
my $oid_cpqNicIfLogMapDescription = '.1.3.6.1.4.1.232.18.2.2.1.1.3';
|
||||
my $oid_cpqNicIfLogMapAdapterCount = '.1.3.6.1.4.1.232.18.2.2.1.1.5';
|
||||
my $oid_cpqNicIfLogMapCondition = '.1.3.6.1.4.1.232.18.2.2.1.1.10';
|
||||
my $oid_cpqNicIfLogMapStatus = '.1.3.6.1.4.1.232.18.2.2.1.1.11';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqNicIfLogMapIndex);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$oid_cpqNicIfLogMapDescription, $oid_cpqNicIfLogMapAdapterCount,
|
||||
$oid_cpqNicIfLogMapCondition, $oid_cpqNicIfLogMapStatus],
|
||||
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 $nic_index = $result->{$key};
|
||||
my $nic_description = centreon::plugins::misc::trim($result2->{$oid_cpqNicIfLogMapDescription . '.' . $instance});
|
||||
my $nic_count = $result2->{$oid_cpqNicIfLogMapAdapterCount . '.' . $instance};
|
||||
my $nic_condition = $result2->{$oid_cpqNicIfLogMapCondition . '.' . $instance};
|
||||
my $nic_status = $result2->{$oid_cpqNicIfLogMapStatus . '.' . $instance};
|
||||
|
||||
$self->{components}->{lnic}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("logical nic %s [adapter count: %s, description: %s, status: %s] condition is %s.",
|
||||
$nic_index, $nic_count, $nic_description,
|
||||
$map_lnic_status{$nic_status},
|
||||
${$conditions{$nic_condition}}[0]));
|
||||
if (${$conditions{$nic_condition}}[0] !~ /^other|ok$/i) {
|
||||
$self->{output}->output_add(severity => ${$conditions{$nic_condition}}[1],
|
||||
short_msg => sprintf("logical nic %d is %s (%s)",
|
||||
$nic_index, ${$conditions{$nic_condition}}[0], $map_lnic_status{$nic_status}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
|
@ -0,0 +1,100 @@
|
|||
################################################################################
|
||||
# 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::pc;
|
||||
|
||||
my %conditions = (
|
||||
1 => ['other', 'CRITICAL'],
|
||||
2 => ['ok', 'OK'],
|
||||
3 => ['degraded', 'WARNING'],
|
||||
4 => ['failed', 'CRITICAL']
|
||||
);
|
||||
|
||||
my %redundant_map = (
|
||||
1 => 'other',
|
||||
2 => 'not redundant',
|
||||
3 => 'redundant',
|
||||
);
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
# In MIB 'CPQHLTH-MIB.mib'
|
||||
$self->{output}->output_add(long_msg => "Checking power converters");
|
||||
$self->{components}->{pc} = {name => 'power converters', total => 0};
|
||||
return if ($self->check_exclude('pc'));
|
||||
|
||||
my $oid_cpqHePwrConvPresent = '.1.3.6.1.4.1.232.6.2.13.3.1.3';
|
||||
my $oid_cpqHePwrConvIndex = '.1.3.6.1.4.1.232.6.2.13.3.1.2';
|
||||
my $oid_cpqHePwrConvChassis = '.1.3.6.1.4.1.232.6.2.13.3.1.1';
|
||||
my $oid_cpqHePwrConvCondition = '.1.3.6.1.4.1.232.6.2.13.3.1.8';
|
||||
my $oid_cpqHePwrConvRedundant = '.1.3.6.1.4.1.232.6.2.13.3.1.6';
|
||||
my $oid_cpqHePwrConvRedundantGroupId = '.1.3.6.1.4.1.232.6.2.13.3.1.7';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqHePwrConvPresent);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
my @get_oids = ();
|
||||
my @oids_end = ();
|
||||
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
|
||||
next if ($present_map{$result->{$key}} ne 'present');
|
||||
# Chassis + index
|
||||
$key =~ /(\d+\.\d+)$/;
|
||||
my $oid_end = $1;
|
||||
|
||||
push @oids_end, $oid_end;
|
||||
push @get_oids, $oid_cpqHePwrConvCondition . "." . $oid_end, $oid_cpqHePwrConvRedundant . "." . $oid_end,
|
||||
$oid_cpqHePwrConvRedundantGroupId . "." . $oid_end;
|
||||
}
|
||||
$result = $self->{snmp}->get_leef(oids => \@get_oids);
|
||||
foreach (@oids_end) {
|
||||
my ($pc_chassis, $pc_index) = split /\./;
|
||||
my $pc_condition = $result->{$oid_cpqHePwrConvIndex . '.' . $_};
|
||||
my $pc_redundant = $result->{$oid_cpqHePwrConvRedundant . '.' . $_};
|
||||
my $pc_redundantgroup = defined($result->{$oid_cpqHePwrConvRedundantGroupId . '.' . $_}) ? $result->{$oid_cpqHePwrConvRedundantGroupId . '.' . $_} : 'undefined';
|
||||
|
||||
$self->{components}->{pc}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("powerconverter %d status is %s [chassis: %s, redundance: %s, redundant group: %s].",
|
||||
$pc_index, ${$conditions{$pc_condition}}[0],
|
||||
$pc_chassis, $redundant_map{$pc_redundant}, $pc_redundantgroup
|
||||
));
|
||||
if ($pc_condition != 2) {
|
||||
$self->{output}->output_add(severity => ${$conditions{$pc_condition}}[1],
|
||||
short_msg => sprintf("powerconverter %d status is %s",
|
||||
$pc_index, ${$conditions{$pc_condition}}[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,137 @@
|
|||
################################################################################
|
||||
# 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::psu;
|
||||
|
||||
my %conditions = (
|
||||
1 => ['other', 'CRITICAL'],
|
||||
2 => ['ok', 'OK'],
|
||||
3 => ['degraded', 'WARNING'],
|
||||
4 => ['failed', 'CRITICAL']
|
||||
);
|
||||
|
||||
my %redundant_map = (
|
||||
1 => 'other',
|
||||
2 => 'not redundant',
|
||||
3 => 'redundant',
|
||||
);
|
||||
|
||||
my %psustatus = (
|
||||
1 => 'noError',
|
||||
2 => 'generalFailure',
|
||||
3 => 'bistFailure',
|
||||
4 => 'fanFailure',
|
||||
5 => 'tempFailure',
|
||||
6 => 'interlockOpen',
|
||||
7 => 'epromFailed',
|
||||
8 => 'vrefFailed',
|
||||
9 => 'dacFailed',
|
||||
10 => 'ramTestFailed',
|
||||
11 => 'voltageChannelFailed',
|
||||
12 => 'orringdiodeFailed',
|
||||
13 => 'brownOut',
|
||||
14 => 'giveupOnStartup',
|
||||
15 => 'nvramInvalid',
|
||||
16 => 'calibrationTableInvalid',
|
||||
);
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
# In MIB 'CPQHLTH-MIB.mib'
|
||||
$self->{output}->output_add(long_msg => "Checking power supplies");
|
||||
$self->{components}->{psu} = {name => 'power supplies', total => 0};
|
||||
return if ($self->check_exclude('psu'));
|
||||
|
||||
my $oid_cpqHeFltTolPowerSupplyPresent = '.1.3.6.1.4.1.232.6.2.9.3.1.3';
|
||||
my $oid_cpqHeFltTolPowerSupplyChassis = '.1.3.6.1.4.1.232.6.2.9.3.1.1';
|
||||
my $oid_cpqHeFltTolPowerSupplyBay = '.1.3.6.1.4.1.232.6.2.9.3.1.2';
|
||||
my $oid_cpqHeFltTolPowerSupplyCondition = '.1.3.6.1.4.1.232.6.2.9.3.1.4';
|
||||
my $oid_cpqHeFltTolPowerSupplyStatus = '.1.3.6.1.4.1.232.6.2.9.3.1.5';
|
||||
my $oid_cpqHeFltTolPowerSupplyRedundant = '.1.3.6.1.4.1.232.6.2.9.3.1.9';
|
||||
my $oid_cpqHeFltTolPowerSupplyCapacityUsed = '.1.3.6.1.4.1.232.6.2.9.3.1.7'; # Watts
|
||||
my $oid_cpqHeFltTolPowerSupplyCapacityMaximum = '.1.3.6.1.4.1.232.6.2.9.3.1.8';
|
||||
my $oid_cpqHeFltTolPowerSupplyMainVoltage = '.1.3.6.1.4.1.232.6.2.9.3.1.6'; # Volts
|
||||
my $oid_cpqHeFltTolPowerSupplyRedundantPartner = '.1.3.6.1.4.1.232.6.2.9.3.1.17';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqHeFltTolPowerSupplyPresent);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
my @get_oids = ();
|
||||
my @oids_end = ();
|
||||
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
|
||||
next if ($present_map{$result->{$key}} ne 'present');
|
||||
# Chassis + Bay
|
||||
$key =~ /(\d+\.\d+)$/;
|
||||
my $oid_end = $1;
|
||||
|
||||
push @oids_end, $oid_end;
|
||||
push @get_oids,
|
||||
$oid_cpqHeFltTolPowerSupplyCondition . "." . $oid_end, $oid_cpqHeFltTolPowerSupplyStatus . "." . $oid_end,
|
||||
$oid_cpqHeFltTolPowerSupplyRedundant . "." . $oid_end, $oid_cpqHeFltTolPowerSupplyCapacityUsed . "." . $oid_end,
|
||||
$oid_cpqHeFltTolPowerSupplyCapacityMaximum . "." . $oid_end, $oid_cpqHeFltTolPowerSupplyMainVoltage . "." . $oid_end,
|
||||
$oid_cpqHeFltTolPowerSupplyRedundantPartner . "." . $oid_end;
|
||||
}
|
||||
$result = $self->{snmp}->get_leef(oids => \@get_oids);
|
||||
foreach (@oids_end) {
|
||||
my ($psu_chassis, $psu_bay) = split /\./;
|
||||
my $psu_condition = $result->{$oid_cpqHeFltTolPowerSupplyCondition . '.' . $_};
|
||||
my $psu_status = $result->{$oid_cpqHeFltTolPowerSupplyStatus . '.' . $_};
|
||||
my $psu_redundant = $result->{$oid_cpqHeFltTolPowerSupplyRedundant . '.' . $_};
|
||||
my $psu_redundantpartner = defined($result->{$oid_cpqHeFltTolPowerSupplyRedundantPartner . '.' . $_}) ? $result->{$oid_cpqHeFltTolPowerSupplyRedundantPartner . '.' . $_} : 'undefined';
|
||||
my $psu_capacityused = $result->{$oid_cpqHeFltTolPowerSupplyCapacityUsed . '.' . $_};
|
||||
my $psu_capacitymaximum = $result->{$oid_cpqHeFltTolPowerSupplyCapacityMaximum . '.' . $_};
|
||||
my $psu_voltage = $result->{$oid_cpqHeFltTolPowerSupplyMainVoltage . '.' . $_};
|
||||
|
||||
$self->{components}->{psu}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("powersupply %d status is %s [chassis: %s, redundance: %s, redundant partner: %s] (status %s).",
|
||||
$psu_bay, ${$conditions{$psu_condition}}[0],
|
||||
$psu_chassis, $redundant_map{$psu_redundant}, $psu_redundantpartner,
|
||||
$psustatus{$psu_status}
|
||||
));
|
||||
if ($psu_condition != 2) {
|
||||
$self->{output}->output_add(severity => ${$conditions{$psu_condition}}[1],
|
||||
short_msg => sprintf("powersupply %d status is %s",
|
||||
$psu_bay, ${$conditions{$psu_condition}}[0]));
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(label => "psu_" . $psu_bay . "_power", unit => 'W',
|
||||
value => $psu_capacityused,
|
||||
critical => $psu_capacitymaximum);
|
||||
$self->{output}->perfdata_add(label => "psu_" . $psu_bay . "_voltage", unit => 'V',
|
||||
value => $psu_voltage);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,109 @@
|
|||
################################################################################
|
||||
# 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::temperature;
|
||||
|
||||
my %location_map = (
|
||||
1 => "other",
|
||||
2 => "unknown",
|
||||
3 => "system",
|
||||
4 => "systemBoard",
|
||||
5 => "ioBoard",
|
||||
6 => "cpu",
|
||||
7 => "memory",
|
||||
8 => "storage",
|
||||
9 => "removableMedia",
|
||||
10 => "powerSupply",
|
||||
11 => "ambient",
|
||||
12 => "chassis",
|
||||
13 => "bridgeCard",
|
||||
);
|
||||
|
||||
my %conditions = (
|
||||
1 => ['other', 'CRITICAL'],
|
||||
2 => ['ok', 'OK'],
|
||||
3 => ['degraded', 'WARNING'],
|
||||
4 => ['failed', 'CRITICAL']
|
||||
);
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
# In MIB 'CPQSTDEQ-MIB.mib'
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking temperatures");
|
||||
$self->{components}->{temperature} = {name => 'temperatures', total => 0};
|
||||
return if ($self->check_exclude('temperature'));
|
||||
|
||||
my $oid_cpqHeTemperatureEntry = '.1.3.6.1.4.1.232.6.2.6.8.1';
|
||||
my $oid_cpqHeTemperatureCondition = '.1.3.6.1.4.1.232.6.2.6.8.1.6';
|
||||
my $oid_cpqHeTemperatureLocale = '.1.3.6.1.4.1.232.6.2.6.8.1.3';
|
||||
my $oid_cpqHeTemperatureCelsius = '.1.3.6.1.4.1.232.6.2.6.8.1.4';
|
||||
my $oid_cpqHeTemperatureThreshold = '.1.3.6.1.4.1.232.6.2.6.8.1.5';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqHeTemperatureEntry);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
|
||||
# work when we have condition
|
||||
next if ($key !~ /^$oid_cpqHeTemperatureCondition/);
|
||||
# Chassis + index
|
||||
$key =~ /(\d+)\.(\d+)$/;
|
||||
my $temp_chassis = $1;
|
||||
my $temp_index = $2;
|
||||
my $instance = $temp_chassis . "." . $temp_index;
|
||||
|
||||
my $temp_condition = $result->{$key};
|
||||
my $temp_current = $result->{$oid_cpqHeTemperatureCelsius . '.' . $instance};
|
||||
my $temp_threshold = $result->{$oid_cpqHeTemperatureThreshold . '.' . $instance};
|
||||
my $temp_locale = $result->{$oid_cpqHeTemperatureLocale . '.' . $instance};
|
||||
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("%s %s temperature is %dC (%d max) (status is %s).",
|
||||
$temp_index, $location_map{$temp_locale}, $temp_current,
|
||||
$temp_threshold,
|
||||
${$conditions{$temp_condition}}[0]));
|
||||
if (${$conditions{$temp_condition}}[1] ne 'OK') {
|
||||
$self->{output}->output_add(severity => ${$conditions{$temp_condition}}[1],
|
||||
short_msg => sprintf("temperature %d %s status is %s",
|
||||
$temp_index, $location_map{$temp_locale}, ${$conditions{$temp_condition}}[0]));
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(label => "temp_" . $temp_index . "_" . $location_map{$temp_locale}, unit => 'C',
|
||||
value => $temp_current,
|
||||
critical => (($temp_threshold != -1) ? $temp_threshold : -1));
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -40,105 +40,13 @@ use base qw(centreon::plugins::mode);
|
|||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
my %cpustatus = (
|
||||
1 => ['unknown', 'UNKNOWN'],
|
||||
2 => ['ok', 'OK'],
|
||||
3 => ['degraded', 'WARNING'],
|
||||
4 => ['failed', 'CRITICAL'],
|
||||
5 => ['disabled', 'OK']
|
||||
);
|
||||
my %conditions = (
|
||||
1 => ['other', 'CRITICAL'],
|
||||
2 => ['ok', 'OK'],
|
||||
3 => ['degraded', 'WARNING'],
|
||||
4 => ['failed', 'CRITICAL']
|
||||
);
|
||||
my %present_map = (
|
||||
1 => 'other',
|
||||
2 => 'absent',
|
||||
3 => 'present',
|
||||
);
|
||||
my %redundant_map = (
|
||||
1 => 'other',
|
||||
2 => 'not redundant',
|
||||
3 => 'redundant',
|
||||
);
|
||||
my %psustatus = (
|
||||
1 => 'noError',
|
||||
2 => 'generalFailure',
|
||||
3 => 'bistFailure',
|
||||
4 => 'fanFailure',
|
||||
5 => 'tempFailure',
|
||||
6 => 'interlockOpen',
|
||||
7 => 'epromFailed',
|
||||
8 => 'vrefFailed',
|
||||
9 => 'dacFailed',
|
||||
10 => 'ramTestFailed',
|
||||
11 => 'voltageChannelFailed',
|
||||
12 => 'orringdiodeFailed',
|
||||
13 => 'brownOut',
|
||||
14 => 'giveupOnStartup',
|
||||
15 => 'nvramInvalid',
|
||||
16 => 'calibrationTableInvalid',
|
||||
);
|
||||
my %location_map = (
|
||||
1 => "other",
|
||||
2 => "unknown",
|
||||
3 => "system",
|
||||
4 => "systemBoard",
|
||||
5 => "ioBoard",
|
||||
6 => "cpu",
|
||||
7 => "memory",
|
||||
8 => "storage",
|
||||
9 => "removableMedia",
|
||||
10 => "powerSupply",
|
||||
11 => "ambient",
|
||||
12 => "chassis",
|
||||
13 => "bridgeCard",
|
||||
);
|
||||
my %fanspeed = (
|
||||
1 => "other",
|
||||
2 => "normal",
|
||||
3 => "high",
|
||||
);
|
||||
my %map_pnic_role = (
|
||||
1 => "unknown",
|
||||
2 => "primary",
|
||||
3 => "secondary",
|
||||
4 => "member",
|
||||
5 => "txRx",
|
||||
6 => "tx",
|
||||
7 => "standby",
|
||||
8 => "none",
|
||||
255 => "notApplicable",
|
||||
);
|
||||
my %map_nic_state = (
|
||||
1 => "unknown",
|
||||
2 => "ok",
|
||||
3 => "standby",
|
||||
4 => "failed",
|
||||
);
|
||||
my %map_pnic_status = (
|
||||
1 => "unknown",
|
||||
2 => "ok",
|
||||
3 => "generalFailure",
|
||||
4 => "linkFailure",
|
||||
);
|
||||
my %map_lnic_status = (
|
||||
1 => "unknown",
|
||||
2 => "ok",
|
||||
3 => "primaryFailed",
|
||||
4 => "standbyFailed",
|
||||
5 => "groupFailed",
|
||||
6 => "redundancyReduced",
|
||||
7 => "redundancyLost",
|
||||
);
|
||||
my %map_nic_duplex = (
|
||||
1 => "unknown",
|
||||
2 => "half",
|
||||
3 => "full",
|
||||
);
|
||||
use hardware::server::hpproliant::mode::components::cpu;
|
||||
use hardware::server::hpproliant::mode::components::psu;
|
||||
use hardware::server::hpproliant::mode::components::pc;
|
||||
use hardware::server::hpproliant::mode::components::fan;
|
||||
use hardware::server::hpproliant::mode::components::temperature;
|
||||
use hardware::server::hpproliant::mode::components::network;
|
||||
use hardware::server::hpproliant::mode::components::ida;
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
|
@ -154,6 +62,7 @@ sub new {
|
|||
$self->{product_name} = undef;
|
||||
$self->{serial} = undef;
|
||||
$self->{romversion} = undef;
|
||||
$self->{components} = {};
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
@ -167,31 +76,32 @@ sub run {
|
|||
# $options{snmp} = snmp object
|
||||
$self->{snmp} = $options{snmp};
|
||||
|
||||
$self->{components_cpu} = 0;
|
||||
$self->{components_psu} = 0;
|
||||
$self->{components_pc} = 0;
|
||||
$self->{components_fan} = 0;
|
||||
$self->{components_temperature} = 0;
|
||||
$self->{components_pnic} = 0;
|
||||
$self->{components_lnic} = 0;
|
||||
|
||||
$self->get_system_information();
|
||||
$self->check_cpu();
|
||||
$self->check_psu();
|
||||
$self->check_pc();
|
||||
$self->check_fan();
|
||||
$self->check_temperature();
|
||||
$self->check_pnic();
|
||||
$self->check_lnic();
|
||||
hardware::server::hpproliant::mode::components::cpu::check($self);
|
||||
hardware::server::hpproliant::mode::components::psu::check($self);
|
||||
hardware::server::hpproliant::mode::components::pc::check($self);
|
||||
hardware::server::hpproliant::mode::components::fan::check($self);
|
||||
hardware::server::hpproliant::mode::components::temperature::check($self);
|
||||
hardware::server::hpproliant::mode::components::network::physical_nic($self);
|
||||
hardware::server::hpproliant::mode::components::network::logical_nic($self);
|
||||
hardware::server::hpproliant::mode::components::ida::array_controller($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::physical_drive($self);
|
||||
|
||||
my $total_components = 0;
|
||||
my $display_by_component = '';
|
||||
my $display_by_component_append = '';
|
||||
foreach my $comp (keys %{$self->{components}}) {
|
||||
$total_components += $self->{components}->{$comp}->{total};
|
||||
$display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . ' ' . $self->{components}->{$comp}->{name};
|
||||
$display_by_component_append = ', ';
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("All %d components [%d cpus, %d power supplies, %d power converters, %d fan, %d temperatures, %d physical nics, %d logical nics] are ok - Product Name: %s, Serial: %s, Rom Version: %s",
|
||||
($self->{components_cpu} + $self->{components_psu} + $self->{components_pc} +
|
||||
$self->{components_fan} + $self->{components_temperature} + $self->{components_pnic} +
|
||||
$self->{components_lnic}),
|
||||
$self->{components_cpu}, $self->{components_psu}, $self->{components_pc},
|
||||
$self->{components_fan}, $self->{components_temperature}, $self->{components_pnic},
|
||||
$self->{components_lnic},
|
||||
short_msg => sprintf("All %s components [%s] are ok - Product Name: %s, Serial: %s, Rom Version: %s",
|
||||
$total_components,
|
||||
$display_by_component,
|
||||
$self->{product_name}, $self->{serial}, $self->{romversion}));
|
||||
|
||||
$self->{output}->display();
|
||||
|
@ -213,358 +123,6 @@ sub get_system_information {
|
|||
$self->{romversion} = defined($result->{$oid_cpqSeSysRomVer}) ? centreon::plugins::misc::trim($result->{$oid_cpqSeSysRomVer}) : 'unknown';
|
||||
}
|
||||
|
||||
sub check_cpu {
|
||||
my ($self) = @_;
|
||||
# In MIB 'CPQSTDEQ-MIB.mib'
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking cpu");
|
||||
return if ($self->check_exclude('cpu'));
|
||||
|
||||
my $oid_cpqSeCpuUnitIndex = '.1.3.6.1.4.1.232.1.2.2.1.1.1';
|
||||
my $oid_cpqSeCpuSlot = '.1.3.6.1.4.1.232.1.2.2.1.1.2';
|
||||
my $oid_cpqSeCpuName = '.1.3.6.1.4.1.232.1.2.2.1.1.3';
|
||||
my $oid_cpqSeCpuStatus = '.1.3.6.1.4.1.232.1.2.2.1.1.6';
|
||||
my $oid_cpqSeCpuSocketNumber = '.1.3.6.1.4.1.232.1.2.2.1.1.9';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqSeCpuUnitIndex);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$oid_cpqSeCpuSlot, $oid_cpqSeCpuName,
|
||||
$oid_cpqSeCpuStatus, $oid_cpqSeCpuSocketNumber],
|
||||
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 $cpu_slot = $result2->{$oid_cpqSeCpuSlot . '.' . $instance};
|
||||
my $cpu_name = $result2->{$oid_cpqSeCpuName . '.' . $instance};
|
||||
my $cpu_status = $result2->{$oid_cpqSeCpuStatus . '.' . $instance};
|
||||
my $cpu_socket_number = $result2->{$oid_cpqSeCpuSocketNumber . '.' . $instance};
|
||||
|
||||
$self->{components_cpu}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("cpu [slot: %s, unit: %s, name: %s, socket: %s] status is %s.",
|
||||
$cpu_slot, $result->{$key}, $cpu_name, $cpu_socket_number,
|
||||
${$cpustatus{$cpu_status}}[0]));
|
||||
if (${$cpustatus{$cpu_status}}[1] ne 'OK') {
|
||||
$self->{output}->output_add(severity => ${$cpustatus{$cpu_status}}[1],
|
||||
short_msg => sprintf("cpu %d is %s",
|
||||
$result->{$key}, ${$cpustatus{$cpu_status}}[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_psu {
|
||||
my ($self) = @_;
|
||||
|
||||
# In MIB 'CPQHLTH-MIB.mib'
|
||||
$self->{output}->output_add(long_msg => "Checking power supplies");
|
||||
return if ($self->check_exclude('psu'));
|
||||
|
||||
my $oid_cpqHeFltTolPowerSupplyPresent = '.1.3.6.1.4.1.232.6.2.9.3.1.3';
|
||||
my $oid_cpqHeFltTolPowerSupplyChassis = '.1.3.6.1.4.1.232.6.2.9.3.1.1';
|
||||
my $oid_cpqHeFltTolPowerSupplyBay = '.1.3.6.1.4.1.232.6.2.9.3.1.2';
|
||||
my $oid_cpqHeFltTolPowerSupplyCondition = '.1.3.6.1.4.1.232.6.2.9.3.1.4';
|
||||
my $oid_cpqHeFltTolPowerSupplyStatus = '.1.3.6.1.4.1.232.6.2.9.3.1.5';
|
||||
my $oid_cpqHeFltTolPowerSupplyRedundant = '.1.3.6.1.4.1.232.6.2.9.3.1.9';
|
||||
my $oid_cpqHeFltTolPowerSupplyCapacityUsed = '.1.3.6.1.4.1.232.6.2.9.3.1.7'; # Watts
|
||||
my $oid_cpqHeFltTolPowerSupplyCapacityMaximum = '.1.3.6.1.4.1.232.6.2.9.3.1.8';
|
||||
my $oid_cpqHeFltTolPowerSupplyMainVoltage = '.1.3.6.1.4.1.232.6.2.9.3.1.6'; # Volts
|
||||
my $oid_cpqHeFltTolPowerSupplyRedundantPartner = '.1.3.6.1.4.1.232.6.2.9.3.1.17';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqHeFltTolPowerSupplyPresent);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
my @get_oids = ();
|
||||
my @oids_end = ();
|
||||
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
|
||||
next if ($present_map{$result->{$key}} ne 'present');
|
||||
# Chassis + Bay
|
||||
$key =~ /(\d+\.\d+)$/;
|
||||
my $oid_end = $1;
|
||||
|
||||
push @oids_end, $oid_end;
|
||||
push @get_oids,
|
||||
$oid_cpqHeFltTolPowerSupplyCondition . "." . $oid_end, $oid_cpqHeFltTolPowerSupplyStatus . "." . $oid_end,
|
||||
$oid_cpqHeFltTolPowerSupplyRedundant . "." . $oid_end, $oid_cpqHeFltTolPowerSupplyCapacityUsed . "." . $oid_end,
|
||||
$oid_cpqHeFltTolPowerSupplyCapacityMaximum . "." . $oid_end, $oid_cpqHeFltTolPowerSupplyMainVoltage . "." . $oid_end,
|
||||
$oid_cpqHeFltTolPowerSupplyRedundantPartner . "." . $oid_end;
|
||||
}
|
||||
$result = $self->{snmp}->get_leef(oids => \@get_oids);
|
||||
foreach (@oids_end) {
|
||||
my ($psu_chassis, $psu_bay) = split /\./;
|
||||
my $psu_condition = $result->{$oid_cpqHeFltTolPowerSupplyCondition . '.' . $_};
|
||||
my $psu_status = $result->{$oid_cpqHeFltTolPowerSupplyStatus . '.' . $_};
|
||||
my $psu_redundant = $result->{$oid_cpqHeFltTolPowerSupplyRedundant . '.' . $_};
|
||||
my $psu_redundantpartner = defined($result->{$oid_cpqHeFltTolPowerSupplyRedundantPartner . '.' . $_}) ? $result->{$oid_cpqHeFltTolPowerSupplyRedundantPartner . '.' . $_} : 'undefined';
|
||||
my $psu_capacityused = $result->{$oid_cpqHeFltTolPowerSupplyCapacityUsed . '.' . $_};
|
||||
my $psu_capacitymaximum = $result->{$oid_cpqHeFltTolPowerSupplyCapacityMaximum . '.' . $_};
|
||||
my $psu_voltage = $result->{$oid_cpqHeFltTolPowerSupplyMainVoltage . '.' . $_};
|
||||
|
||||
$self->{components_psu}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("powersupply %d status is %s [chassis: %s, redundance: %s, redundant partner: %s] (status %s).",
|
||||
$psu_bay, ${$conditions{$psu_condition}}[0],
|
||||
$psu_chassis, $redundant_map{$psu_redundant}, $psu_redundantpartner,
|
||||
$psustatus{$psu_status}
|
||||
));
|
||||
if ($psu_condition != 2) {
|
||||
$self->{output}->output_add(severity => ${$conditions{$psu_condition}}[1],
|
||||
short_msg => sprintf("powersupply %d status is %s",
|
||||
$psu_bay, ${$conditions{$psu_condition}}[0]));
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(label => "psu_" . $psu_bay . "_power", unit => 'W',
|
||||
value => $psu_capacityused,
|
||||
critical => $psu_capacitymaximum);
|
||||
$self->{output}->perfdata_add(label => "psu_" . $psu_bay . "_voltage", unit => 'V',
|
||||
value => $psu_voltage);
|
||||
}
|
||||
}
|
||||
|
||||
sub check_pc {
|
||||
my ($self) = @_;
|
||||
|
||||
# In MIB 'CPQHLTH-MIB.mib'
|
||||
$self->{output}->output_add(long_msg => "Checking power converters");
|
||||
return if ($self->check_exclude('pc'));
|
||||
|
||||
my $oid_cpqHePwrConvPresent = '.1.3.6.1.4.1.232.6.2.13.3.1.3';
|
||||
my $oid_cpqHePwrConvIndex = '.1.3.6.1.4.1.232.6.2.13.3.1.2';
|
||||
my $oid_cpqHePwrConvChassis = '.1.3.6.1.4.1.232.6.2.13.3.1.1';
|
||||
my $oid_cpqHePwrConvCondition = '.1.3.6.1.4.1.232.6.2.13.3.1.8';
|
||||
my $oid_cpqHePwrConvRedundant = '.1.3.6.1.4.1.232.6.2.13.3.1.6';
|
||||
my $oid_cpqHePwrConvRedundantGroupId = '.1.3.6.1.4.1.232.6.2.13.3.1.7';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqHePwrConvPresent);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
my @get_oids = ();
|
||||
my @oids_end = ();
|
||||
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
|
||||
next if ($present_map{$result->{$key}} ne 'present');
|
||||
# Chassis + index
|
||||
$key =~ /(\d+\.\d+)$/;
|
||||
my $oid_end = $1;
|
||||
|
||||
push @oids_end, $oid_end;
|
||||
push @get_oids, $oid_cpqHePwrConvCondition . "." . $oid_end, $oid_cpqHePwrConvRedundant . "." . $oid_end,
|
||||
$oid_cpqHePwrConvRedundantGroupId . "." . $oid_end;
|
||||
}
|
||||
$result = $self->{snmp}->get_leef(oids => \@get_oids);
|
||||
foreach (@oids_end) {
|
||||
my ($pc_chassis, $pc_index) = split /\./;
|
||||
my $pc_condition = $result->{$oid_cpqHePwrConvIndex . '.' . $_};
|
||||
my $pc_redundant = $result->{$oid_cpqHePwrConvRedundant . '.' . $_};
|
||||
my $pc_redundantgroup = defined($result->{$oid_cpqHePwrConvRedundantGroupId . '.' . $_}) ? $result->{$oid_cpqHePwrConvRedundantGroupId . '.' . $_} : 'undefined';
|
||||
|
||||
$self->{components_pc}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("powerconverter %d status is %s [chassis: %s, redundance: %s, redundant group: %s].",
|
||||
$pc_index, ${$conditions{$pc_condition}}[0],
|
||||
$pc_chassis, $redundant_map{$pc_redundant}, $pc_redundantgroup
|
||||
));
|
||||
if ($pc_condition != 2) {
|
||||
$self->{output}->output_add(severity => ${$conditions{$pc_condition}}[1],
|
||||
short_msg => sprintf("powerconverter %d status is %s",
|
||||
$pc_index, ${$conditions{$pc_condition}}[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_fan {
|
||||
my ($self) = @_;
|
||||
|
||||
# In MIB 'CPQHLTH-MIB.mib'
|
||||
$self->{output}->output_add(long_msg => "Checking fans");
|
||||
return if ($self->check_exclude('fan'));
|
||||
|
||||
my $oid_cpqHeFltTolFanPresent = '.1.3.6.1.4.1.232.6.2.6.7.1.4';
|
||||
my $oid_cpqHeFltTolFanChassis = '.1.3.6.1.4.1.232.6.2.6.7.1.1';
|
||||
my $oid_cpqHeFltTolFanIndex = '.1.3.6.1.4.1.232.6.2.6.7.1.2';
|
||||
my $oid_cpqHeFltTolFanLocale = '.1.3.6.1.4.1.232.6.2.6.7.1.3';
|
||||
my $oid_cpqHeFltTolFanCondition = '.1.3.6.1.4.1.232.6.2.6.7.1.9';
|
||||
my $oid_cpqHeFltTolFanSpeed = '.1.3.6.1.4.1.232.6.2.6.7.1.6';
|
||||
my $oid_cpqHeFltTolFanCurrentSpeed = '.1.3.6.1.4.1.232.6.2.6.7.1.12';
|
||||
my $oid_cpqHeFltTolFanRedundant = '.1.3.6.1.4.1.232.6.2.6.7.1.7';
|
||||
my $oid_cpqHeFltTolFanRedundantPartner = '.1.3.6.1.4.1.232.6.2.6.7.1.8';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqHeFltTolFanPresent);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
my @get_oids = ();
|
||||
my @oids_end = ();
|
||||
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
|
||||
next if ($present_map{$result->{$key}} ne 'present');
|
||||
# Chassis + index
|
||||
$key =~ /(\d+\.\d+)$/;
|
||||
my $oid_end = $1;
|
||||
|
||||
push @oids_end, $oid_end;
|
||||
push @get_oids, $oid_cpqHeFltTolFanLocale . "." . $oid_end, $oid_cpqHeFltTolFanCondition . "." . $oid_end,
|
||||
$oid_cpqHeFltTolFanCurrentSpeed . "." . $oid_end, $oid_cpqHeFltTolFanSpeed . "." . $oid_end,
|
||||
$oid_cpqHeFltTolFanRedundant . "." . $oid_end, $oid_cpqHeFltTolFanRedundantPartner . "." . $oid_end;
|
||||
}
|
||||
$result = $self->{snmp}->get_leef(oids => \@get_oids);
|
||||
foreach (@oids_end) {
|
||||
my ($fan_chassis, $fan_index) = split /\./;
|
||||
my $fan_locale = $result->{$oid_cpqHeFltTolFanLocale . '.' . $_};
|
||||
my $fan_condition = $result->{$oid_cpqHeFltTolFanCondition . '.' . $_};
|
||||
my $fan_speed = $result->{$oid_cpqHeFltTolFanSpeed . '.' . $_};
|
||||
my $fan_currentspeed = $result->{$oid_cpqHeFltTolFanCurrentSpeed . '.' . $_};
|
||||
my $fan_redundant = $result->{$oid_cpqHeFltTolFanRedundant . '.' . $_};
|
||||
my $fan_redundantpartner = $result->{$oid_cpqHeFltTolFanRedundantPartner . '.' . $_};
|
||||
|
||||
$self->{components_fan}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("fan %d status is %s, speed is %s [chassis: %s, location: %s, redundance: %s, redundant partner: %s].",
|
||||
$fan_index, ${$conditions{$fan_condition}}[0], $fanspeed{$fan_speed},
|
||||
$fan_chassis, $location_map{$fan_locale},
|
||||
$redundant_map{$fan_redundant}, $fan_redundantpartner
|
||||
));
|
||||
if ($fan_condition != 2) {
|
||||
$self->{output}->output_add(severity => ${$conditions{$fan_condition}}[1],
|
||||
short_msg => sprintf("fan %d status is %s",
|
||||
$fan_index, ${$conditions{$fan_condition}}[0]));
|
||||
}
|
||||
|
||||
if (defined($fan_currentspeed)) {
|
||||
$self->{output}->perfdata_add(label => "fan_" . $fan_index . "_speed", unit => 'rpm',
|
||||
value => $fan_currentspeed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_temperature {
|
||||
my ($self) = @_;
|
||||
# In MIB 'CPQSTDEQ-MIB.mib'
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking temperatures");
|
||||
return if ($self->check_exclude('temperature'));
|
||||
|
||||
my $oid_cpqHeTemperatureEntry = '.1.3.6.1.4.1.232.6.2.6.8.1';
|
||||
my $oid_cpqHeTemperatureCondition = '.1.3.6.1.4.1.232.6.2.6.8.1.6';
|
||||
my $oid_cpqHeTemperatureLocale = '.1.3.6.1.4.1.232.6.2.6.8.1.3';
|
||||
my $oid_cpqHeTemperatureCelsius = '.1.3.6.1.4.1.232.6.2.6.8.1.4';
|
||||
my $oid_cpqHeTemperatureThreshold = '.1.3.6.1.4.1.232.6.2.6.8.1.5';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqHeTemperatureEntry);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) {
|
||||
# work when we have condition
|
||||
next if ($key !~ /^$oid_cpqHeTemperatureCondition/);
|
||||
# Chassis + index
|
||||
$key =~ /(\d+)\.(\d+)$/;
|
||||
my $temp_chassis = $1;
|
||||
my $temp_index = $2;
|
||||
my $instance = $temp_chassis . "." . $temp_index;
|
||||
|
||||
my $temp_condition = $result->{$key};
|
||||
my $temp_current = $result->{$oid_cpqHeTemperatureCelsius . '.' . $instance};
|
||||
my $temp_threshold = $result->{$oid_cpqHeTemperatureThreshold . '.' . $instance};
|
||||
my $temp_locale = $result->{$oid_cpqHeTemperatureLocale . '.' . $instance};
|
||||
|
||||
$self->{components_temperature}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("%s %s temperature is %dC (%d max) (status is %s).",
|
||||
$temp_index, $location_map{$temp_locale}, $temp_current,
|
||||
$temp_threshold,
|
||||
${$conditions{$temp_condition}}[0]));
|
||||
if (${$conditions{$temp_condition}}[1] ne 'OK') {
|
||||
$self->{output}->output_add(severity => ${$conditions{$temp_condition}}[1],
|
||||
short_msg => sprintf("temperature %d %s status is %s",
|
||||
$temp_index, $location_map{$temp_locale}, ${$conditions{$temp_condition}}[0]));
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(label => "temp_" . $temp_index . "_" . $location_map{$temp_locale}, unit => 'C',
|
||||
value => $temp_current,
|
||||
critical => (($temp_threshold != -1) ? $temp_threshold : -1));
|
||||
}
|
||||
}
|
||||
|
||||
sub check_pnic {
|
||||
my ($self) = @_;
|
||||
# In MIB 'CPQNIC-MIB.mib'
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking physical nics");
|
||||
return if ($self->check_exclude('pnic'));
|
||||
|
||||
my $oid_cpqNicIfPhysAdapterIndex = '.1.3.6.1.4.1.232.18.2.3.1.1.1';
|
||||
my $oid_cpqNicIfPhysAdapterRole = '.1.3.6.1.4.1.232.18.2.3.1.1.3';
|
||||
my $oid_cpqNicIfPhysAdapterCondition = '.1.3.6.1.4.1.232.18.2.3.1.1.12';
|
||||
my $oid_cpqNicIfPhysAdapterState = '.1.3.6.1.4.1.232.18.2.3.1.1.13';
|
||||
my $oid_cpqNicIfPhysAdapterStatus = '.1.3.6.1.4.1.232.18.2.3.1.1.14';
|
||||
my $oid_cpqNicIfPhysAdapterDuplexState = '.1.3.6.1.4.1.232.18.2.3.1.1.11';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqNicIfPhysAdapterIndex);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$oid_cpqNicIfPhysAdapterRole, $oid_cpqNicIfPhysAdapterCondition,
|
||||
$oid_cpqNicIfPhysAdapterState, $oid_cpqNicIfPhysAdapterStatus,
|
||||
$oid_cpqNicIfPhysAdapterDuplexState],
|
||||
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 $nic_index = $result->{$key};
|
||||
my $nic_role = $result2->{$oid_cpqNicIfPhysAdapterRole . '.' . $instance};
|
||||
my $nic_condition = $result2->{$oid_cpqNicIfPhysAdapterCondition . '.' . $instance};
|
||||
my $nic_state = $result2->{$oid_cpqNicIfPhysAdapterState . '.' . $instance};
|
||||
my $nic_status = $result2->{$oid_cpqNicIfPhysAdapterStatus . '.' . $instance};
|
||||
my $nic_duplex = $result2->{$oid_cpqNicIfPhysAdapterDuplexState . '.' . $instance};
|
||||
|
||||
$self->{components_pnic}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("physical nic %s [duplex: %s, role: %s, state: %s, status: %s] condition is %s.",
|
||||
$nic_index, $map_nic_duplex{$nic_duplex}, $map_pnic_role{$nic_role},
|
||||
$map_nic_state{$nic_state}, $map_pnic_status{$nic_status},
|
||||
${$conditions{$nic_condition}}[0]));
|
||||
if (${$conditions{$nic_condition}}[1] ne 'OK') {
|
||||
$self->{output}->output_add(severity => ${$conditions{$nic_condition}}[1],
|
||||
short_msg => sprintf("physical nic %d is %s",
|
||||
$nic_index, ${$conditions{$nic_condition}}[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_lnic {
|
||||
my ($self) = @_;
|
||||
# In MIB 'CPQNIC-MIB.mib'
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking logical nics");
|
||||
return if ($self->check_exclude('pnic'));
|
||||
|
||||
my $oid_cpqNicIfLogMapIndex = '.1.3.6.1.4.1.232.18.2.2.1.1.1';
|
||||
my $oid_cpqNicIfLogMapDescription = '.1.3.6.1.4.1.232.18.2.2.1.1.3';
|
||||
my $oid_cpqNicIfLogMapAdapterCount = '.1.3.6.1.4.1.232.18.2.2.1.1.5';
|
||||
my $oid_cpqNicIfLogMapCondition = '.1.3.6.1.4.1.232.18.2.2.1.1.10';
|
||||
my $oid_cpqNicIfLogMapStatus = '.1.3.6.1.4.1.232.18.2.2.1.1.11';
|
||||
|
||||
my $result = $self->{snmp}->get_table(oid => $oid_cpqNicIfLogMapIndex);
|
||||
return if (scalar(keys %$result) <= 0);
|
||||
|
||||
$self->{snmp}->load(oids => [$oid_cpqNicIfLogMapDescription, $oid_cpqNicIfLogMapAdapterCount,
|
||||
$oid_cpqNicIfLogMapCondition, $oid_cpqNicIfLogMapStatus],
|
||||
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 $nic_index = $result->{$key};
|
||||
my $nic_description = centreon::plugins::misc::trim($result2->{$oid_cpqNicIfLogMapDescription . '.' . $instance});
|
||||
my $nic_count = $result2->{$oid_cpqNicIfLogMapAdapterCount . '.' . $instance};
|
||||
my $nic_condition = $result2->{$oid_cpqNicIfLogMapCondition . '.' . $instance};
|
||||
my $nic_status = $result2->{$oid_cpqNicIfLogMapStatus . '.' . $instance};
|
||||
|
||||
$self->{components_lnic}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("logical nic %s [adapter count: %s, description: %s, status: %s] condition is %s.",
|
||||
$nic_index, $nic_count, $nic_description,
|
||||
$map_lnic_status{$nic_status},
|
||||
${$conditions{$nic_condition}}[0]));
|
||||
if (${$conditions{$nic_condition}}[0] !~ /^other|ok$/i) {
|
||||
$self->{output}->output_add(severity => ${$conditions{$nic_condition}}[1],
|
||||
short_msg => sprintf("logical nic %d is %s (%s)",
|
||||
$nic_index, ${$conditions{$nic_condition}}[0], $map_lnic_status{$nic_status}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub check_exclude {
|
||||
my ($self, $section) = @_;
|
||||
|
||||
|
|
Loading…
Reference in New Issue