+ Refactoring and update of hp server checks
This commit is contained in:
parent
ef3fb8ef3d
commit
937632660d
|
@ -66,7 +66,7 @@ sub check {
|
|||
|
||||
return if ($self->check_exclude(section => 'sp', instance => $instance));
|
||||
return if ($sp_status =~ /noStatus/i &&
|
||||
$self->absent_problem(section => 'sp', instance => $instance));
|
||||
$self->absent_problem(section => 'sp', instance => $instance));
|
||||
|
||||
$self->{components}->{sp}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Sensor probe '%s' status is '%s'",
|
||||
|
|
|
@ -112,7 +112,7 @@ sub check {
|
|||
$exit = $self->{perfdata}->threshold_check(value => $result->{sensorProbeTempDegree}, threshold => [ { label => 'critical-temperature-instance-' . $instance, exit_litteral => 'critical' },
|
||||
{ label => 'warning-temperature-instance-' . $instance, exit_litteral => 'warning' } ]);
|
||||
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-temperature-instance-' . $instance);
|
||||
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $instance)
|
||||
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $instance);
|
||||
}
|
||||
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
|
|
|
@ -38,54 +38,52 @@ package hardware::server::hp::proliant::snmp::mode::components::cpu;
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %cpustatus = (
|
||||
1 => ['unknown', 'UNKNOWN'],
|
||||
2 => ['ok', 'OK'],
|
||||
3 => ['degraded', 'WARNING'],
|
||||
4 => ['failed', 'CRITICAL'],
|
||||
5 => ['disabled', 'OK']
|
||||
my %map_cpu_status = (
|
||||
1 => 'unknown',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
5 => 'disabled',
|
||||
);
|
||||
|
||||
# In MIB 'CPQSTDEQ-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqSeCpuSlot => { oid => '.1.3.6.1.4.1.232.1.2.2.1.1.2' },
|
||||
cpqSeCpuName => { oid => '.1.3.6.1.4.1.232.1.2.2.1.1.3' },
|
||||
cpqSeCpuStatus => { oid => '.1.3.6.1.4.1.3854.1.2.2.1.16.1.5', map => \%map_cpu_status },
|
||||
cpqSeCpuSocketNumber => { oid => '.1.3.6.1.4.1.232.1.2.2.1.1.9' },
|
||||
};
|
||||
my $oid_cpqSeCpuEntry = '.1.3.6.1.4.1.232.1.2.2.1.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqSeCpuEntry, start => $mapping->{cpqSeCpuSlot}->{oid}, end => $mapping->{cpqSeCpuSocketNumber}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
# In MIB 'CPQSTDEQ-MIB.mib'
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking cpu");
|
||||
$self->{components}->{cpu} = {name => 'cpus', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => '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+)$/;
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqSeCpuEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqSeCpuStatus}->{oid}\.(.*)$/);
|
||||
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};
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqSeCpuEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'cpu', instance => $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]));
|
||||
$self->{output}->output_add(long_msg => sprintf("cpu '%s' [slot: %s, unit: %s, name: %s, socket: %s] status is %s.",
|
||||
$instance, $result->{cpqSeCpuSlot}, $result->{cpqSeCpuSlot}, $result->{cpqSeCpuName}, $result->{cpqSeCpuSocketNumber},
|
||||
$result->{cpqSeCpuStatus}));
|
||||
my $exit = $self->get_severity(section => 'cpu', value => $result->{cpqSeCpuStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("cpu '%s' is %s",
|
||||
$instance, $result->{cpqSeCpuStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::daacc;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_daacc_status = {
|
||||
1 => 'other',
|
||||
2 => 'invalid',
|
||||
3 => 'enabled',
|
||||
4 => 'tmpDisabled',
|
||||
5 => 'permDisabled',
|
||||
};
|
||||
my %map_daacc_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
my %map_daaccbattery_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'recharging',
|
||||
4 => 'failed',
|
||||
5 => 'degraded',
|
||||
6 => 'not present',
|
||||
);
|
||||
|
||||
# In 'CPQIDA-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqDaAccelStatus => { oid => '.1.3.6.1.4.1.232.3.2.2.2.1.2', map => \%map_daacc_status },
|
||||
};
|
||||
my $mapping2 = {
|
||||
cpqDaAccelBattery => { oid => '.1.3.6.1.4.1.232.3.2.2.2.1.6', map => \%map_daaccbattery_condition },
|
||||
};
|
||||
my $mapping3 = {
|
||||
cpqDaAccelCondition => { oid => '.1.3.6.1.4.1.232.3.2.2.2.1.9', map => \%map_daacc_condition },
|
||||
};
|
||||
my $oid_cpqDaAccelStatus = '.1.3.6.1.4.1.232.3.2.2.2.1.2';
|
||||
my $oid_cpqDaAccelBattery = '.1.3.6.1.4.1.232.3.2.2.2.1.6';
|
||||
my $oid_cpqDaAccelCondition = '.1.3.6.1.4.1.232.3.2.2.2.1.9';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqDaAccelStatus };
|
||||
push @{$options{request}}, { oid => $oid_cpqDaAccelBattery };
|
||||
push @{$options{request}}, { oid => $oid_cpqDaAccelCondition };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking da accelerator boards");
|
||||
$self->{components}->{daacc} = {name => 'da accelerator boards', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'daacc'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqDaAccelCondition}})) {
|
||||
next if ($oid !~ /^$mapping3->{cpqDaAccelCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqDaAccelStatus}, instance => $instance);
|
||||
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqDaAccelBattery}, instance => $instance);
|
||||
my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$oid_cpqDaAccelCondition}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'daacc', instance => $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, $result->{cpqDaAccelStatus}, $result2->{cpqDaAccelBattery},
|
||||
$result3->{cpqDaAccelCondition}));
|
||||
my $exit = $self->get_severity(section => 'daacc', value => $result3->{cpqDaAccelCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("da controller accelerator '%s' is %s",
|
||||
$instance, $result3->{cpqDaAccelCondition}));
|
||||
}
|
||||
$exit = $self->get_severity(section => 'daaccbattery', value => $result3->{cpqDaAccelBattery});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("da controller accelerator '%s' battery is %s",
|
||||
$instance, $result3->{cpqDaAccelBattery}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,138 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::dactl;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_controller_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
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'
|
||||
);
|
||||
# In 'CPQIDA-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqDaCntlrModel => { oid => '.1.3.6.1.4.1.232.3.2.2.1.1.2', map => \%model_map },
|
||||
};
|
||||
my $mapping2 = {
|
||||
cpqDaCntlrSlot => { oid => '.1.3.6.1.4.1.232.3.2.2.1.1.5' },
|
||||
cpqDaCntlrCondition => { oid => '.1.3.6.1.4.1.232.3.2.2.1.1.6', map => \%map_controller_condition },
|
||||
};
|
||||
my $oid_cpqDaCntlrEntry = '.1.3.6.1.4.1.232.3.2.2.1.1';
|
||||
my $oid_cpqDaCntlrModel = '.1.3.6.1.4.1.232.3.2.2.1.1.2';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqDaCntlrEntry, start => $mapping->{cpqDaCntlrSlot}->{oid}, end => $mapping->{cpqDaCntlrCondition}->{oid} };
|
||||
push @{$options{request}}, { oid => $oid_cpqDaCntlrModel };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking da controller");
|
||||
$self->{components}->{dactl} = {name => 'da controllers', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'dactl'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqDaCntlrEntry}})) {
|
||||
next if ($oid !~ /^$mapping2->{cpqDaCntlrCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqDaCntlrModel}, instance => $instance);
|
||||
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqDaCntlrEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'dactl', instance => $instance));
|
||||
$self->{components}->{dactl}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("da controller '%s' [slot: %s, model: %s] status is %s.",
|
||||
$instance, $result2->{cpqDaCntlrSlot}, $result->{cpqDaCntlrModel},
|
||||
$result2->{cpqDaCntlrCondition}));
|
||||
my $exit = $self->get_severity(section => 'dactl', value => $result2->{cpqDaCntlrCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("da controller '%s' is %s",
|
||||
$instance, $result2->{cpqDaCntlrCondition}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,123 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::daldrive;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_daldrive_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
my %map_ldrive_status = (
|
||||
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 %map_faulttol = (
|
||||
1 => 'other',
|
||||
2 => 'none',
|
||||
3 => 'mirroring',
|
||||
4 => 'dataGuard',
|
||||
5 => 'distribDataGuard',
|
||||
7 => 'advancedDataGuard',
|
||||
8 => 'raid50',
|
||||
9 => 'raid60',
|
||||
);
|
||||
# In 'CPQIDA-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqDaLogDrvFaultTol => { oid => '.1.3.6.1.4.1.232.3.2.3.1.1.3', map => \%map_faulttol },
|
||||
cpqDaLogDrvStatus => { oid => '.1.3.6.1.4.1.232.3.2.3.1.1.4', map => \%map_ldrive_status },
|
||||
};
|
||||
my $mapping2 = {
|
||||
cpqDaLogDrvCondition => { oid => '.1.3.6.1.4.1.232.3.2.3.1.1.11', map => \%map_daldrive_condition },
|
||||
};
|
||||
my $oid_cpqDaLogDrvEntry = '.1.3.6.1.4.1.232.3.2.3.1.1';
|
||||
my $oid_cpqDaLogDrvCondition = '.1.3.6.1.4.1.232.3.2.3.1.1.11';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqDaLogDrvEntry, start => $mapping->{cpqDaLogDrvFaultTol}->{oid}, end => $mapping->{cpqDaLogDrvStatus}->{oid} };
|
||||
push @{$options{request}}, { oid => $oid_cpqDaLogDrvCondition };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking da logical drives");
|
||||
$self->{components}->{daldrive} = {name => 'da logical drives', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'daldrive'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqDaLogDrvCondition}})) {
|
||||
next if ($oid !~ /^$mapping2->{cpqDaLogDrvCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqDaLogDrvEntry}, instance => $instance);
|
||||
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqDaLogDrvCondition}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'daldrive', instance => $instance));
|
||||
$self->{components}->{daldrive}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("da logical drive '%s' [fault tolerance: %s, condition: %s] status is %s.",
|
||||
$instance,
|
||||
$result->{cpqDaLogDrvFaultTol},
|
||||
$result2->{cpqDaLogDrvCondition},
|
||||
$result->{cpqDaLogDrvStatus}));
|
||||
my $exit = $self->get_severity(section => 'daldrive', value => $result->{cpqDaLogDrvStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("da logical drive '%s' is %s",
|
||||
$instance, $result->{cpqDaLogDrvStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,102 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::dapdrive;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_dapdrive_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
my %map_dapdrive_status = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'failed',
|
||||
4 => 'predictiveFailure',
|
||||
5 => 'erasing',
|
||||
6 => 'eraseDone',
|
||||
7 => 'eraseQueued',
|
||||
);
|
||||
# In 'CPQIDA-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqDaPhyDrvStatus => { oid => '.1.3.6.1.4.1.232.3.2.5.1.1.6', map => \%map_dapdrive_status },
|
||||
};
|
||||
my $mapping2 = {
|
||||
cpqDaPhyDrvCondition => { oid => '.1.3.6.1.4.1.232.3.2.5.1.1.37', map => \%map_dapdrive_condition },
|
||||
};
|
||||
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';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqDaPhyDrvStatus };
|
||||
push @{$options{request}}, { oid => $oid_cpqDaPhyDrvCondition };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking da physical drives");
|
||||
$self->{components}->{dapdrive} = {name => 'da physical drives', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'dapdrive'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqDaPhyDrvCondition}})) {
|
||||
next if ($oid !~ /^$mapping2->{cpqDaPhyDrvCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqDaPhyDrvStatus}, instance => $instance);
|
||||
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqDaPhyDrvCondition}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'dapdrive', instance => $instance));
|
||||
$self->{components}->{dapdrive}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("da physical drive '%s' [status: %s] condition is %s.",
|
||||
$instance,
|
||||
$result->{cpqDaPhyDrvStatus},
|
||||
$result2->{cpqDaPhyDrvCondition}));
|
||||
my $exit = $self->get_severity(section => 'dapdrive', value => $result2->{cpqDaPhyDrvCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("da physical drive '%s' is %s",
|
||||
$instance, $result2->{cpqDaPhyDrvCondition}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -38,26 +38,23 @@ package hardware::server::hp::proliant::snmp::mode::components::fan;
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %conditions = (
|
||||
1 => ['other', 'CRITICAL'],
|
||||
2 => ['ok', 'OK'],
|
||||
3 => ['degraded', 'WARNING'],
|
||||
4 => ['failed', 'CRITICAL']
|
||||
my %map_fan_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
my %present_map = (
|
||||
my %map_present = (
|
||||
1 => 'other',
|
||||
2 => 'absent',
|
||||
3 => 'present',
|
||||
);
|
||||
|
||||
my %redundant_map = (
|
||||
my %map_redundant = (
|
||||
1 => 'other',
|
||||
2 => 'not redundant',
|
||||
3 => 'redundant',
|
||||
);
|
||||
|
||||
my %location_map = (
|
||||
my %map_location = (
|
||||
1 => "other",
|
||||
2 => "unknown",
|
||||
3 => "system",
|
||||
|
@ -77,76 +74,63 @@ my %location_map = (
|
|||
17 => "bladeSlot",
|
||||
18 => "virtual",
|
||||
);
|
||||
|
||||
my %fanspeed = (
|
||||
my %map_fanspeed = (
|
||||
1 => "other",
|
||||
2 => "normal",
|
||||
3 => "high",
|
||||
);
|
||||
|
||||
# In MIB 'CPQHLTH-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqHeFltTolFanLocale => { oid => '.1.3.6.1.4.1.232.6.2.6.7.1.3', map => \%map_location },
|
||||
cpqHeFltTolFanPresent => { oid => '.1.3.6.1.4.1.232.6.2.6.7.1.4', map => \%map_present },
|
||||
cpqHeFltTolFanSpeed => { oid => '.1.3.6.1.4.1.232.6.2.6.7.1.6', map => \%map_fanspeed },
|
||||
cpqHeFltTolFanRedundant => { oid => '.1.3.6.1.4.1.232.6.2.6.7.1.7', map => \%map_redundant },
|
||||
cpqHeFltTolFanRedundantPartner => { oid => '.1.3.6.1.4.1.232.6.2.6.7.1.8' },
|
||||
cpqHeFltTolFanCondition => { oid => '.1.3.6.1.4.1.232.6.2.6.7.1.9', map => \%map_fan_condition },
|
||||
cpqHeFltTolFanCurrentSpeed => { oid => '.1.3.6.1.4.1.232.6.2.6.7.1.12' },
|
||||
};
|
||||
my $oid_cpqHeFltTolFanEntry = '.1.3.6.1.4.1.232.6.2.6.7.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqHeFltTolFanEntry, start => $mapping->{cpqHeFltTolFanLocale}->{oid}, end => $mapping->{cpqHeFltTolFanCurrentSpeed}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
# In MIB 'CPQHLTH-MIB.mib'
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking fans");
|
||||
$self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => '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)) {
|
||||
# Chassis + index
|
||||
$key =~ /(\d+)\.(\d+)$/;
|
||||
my $oid_end = $1 . '.' . $2;
|
||||
|
||||
next if ($present_map{$result->{$key}} ne 'present' &&
|
||||
$self->absent_problem(section => 'fan', instance => $1 . '.' . $2));
|
||||
|
||||
|
||||
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 . '.' . $_};
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqHeFltTolFanEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqHeFltTolFanCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqHeFltTolFanEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'fan', instance => $fan_chassis . '.' . $fan_index));
|
||||
next if ($self->check_exclude(section => 'fan', instance => $instance));
|
||||
next if ($result->{cpqHeFltTolFanPresent} !~ /present/i &&
|
||||
$self->absent_problem(section => 'fan', instance => $instance));
|
||||
$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
|
||||
$self->{output}->output_add(long_msg => sprintf("fan '%s' status is %s, speed is %s [location: %s, redundance: %s, redundant partner: %s].",
|
||||
$instance, $result->{cpqHeFltTolFanCondition}, $result->{cpqHeFltTolFanSpeed},
|
||||
$result->{cpqHeFltTolFanLocale},
|
||||
$result->{cpqHeFltTolFanRedundant}, $result->{cpqHeFltTolFanRedundantPartner}
|
||||
));
|
||||
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]));
|
||||
my $exit = $self->get_severity(section => 'fan', value => $result->{cpqHeFltTolFanCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("fan '%s' status is %s",
|
||||
$instance, $result->{cpqHeFltTolFanCondition}));
|
||||
}
|
||||
|
||||
if (defined($fan_currentspeed)) {
|
||||
$self->{output}->perfdata_add(label => "fan_" . $fan_index . "_speed", unit => 'rpm',
|
||||
value => $fan_currentspeed);
|
||||
if (defined($result->{cpqHeFltTolFanCurrentSpeed})) {
|
||||
$self->{output}->perfdata_add(label => "fan_speed_" . $instance, unit => 'rpm',
|
||||
value => $result->{cpqHeFltTolFanCurrentSpeed});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,412 +0,0 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::fca;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# 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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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 = (defined($result2->{$oid_cpqFcaHostCntlrModel . '.' . $instance}) && defined($model_map{$result2->{$oid_cpqFcaHostCntlrModel . '.' . $instance}})) ?
|
||||
$model_map{$result2->{$oid_cpqFcaHostCntlrModel . '.' . $instance}} : 'unknown';
|
||||
my $fca_slot = $result2->{$oid_cpqFcaHostCntlrSlot . '.' . $instance};
|
||||
my $fca_condition = $result2->{$oid_cpqFcaHostCntlrCondition . '.' . $instance};
|
||||
|
||||
next if ($self->check_exclude(section => 'fcahostctl', instance => $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, $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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'fcaexternalctl', instance => $instance));
|
||||
$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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'fcaexternalacc', instance => $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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'fcaldrive', instance => $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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'fcapdrive', instance => $instance));
|
||||
$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;
|
|
@ -0,0 +1,121 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::fcaexternalacc;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_accel_status = (
|
||||
1 => 'other',
|
||||
2 => 'invalid',
|
||||
3 => 'enabled',
|
||||
4 => 'tmpDisabled',
|
||||
5 => 'permDisabled',
|
||||
);
|
||||
my %map_accel_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
my %map_accelbattery_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'recharging',
|
||||
4 => 'failed',
|
||||
5 => 'degraded',
|
||||
6 => 'not present',
|
||||
);
|
||||
|
||||
# In 'CPQFCA-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqFcaAccelStatus => { oid => '.1.3.6.1.4.1.232.16.2.2.2.1.3', map => \%map_accel_status },
|
||||
};
|
||||
my $mapping2 = {
|
||||
cpqFcaAccelCondition => { oid => '.1.3.6.1.4.1.232.16.2.2.2.1.9', map => \%map_accel_condition },
|
||||
};
|
||||
my $mapping3 = {
|
||||
cpqFcaAccelBatteryStatus => { oid => '.1.3.6.1.4.1.232.16.2.2.2.1.6', map => \%map_accelbattery_condition },
|
||||
};
|
||||
my $oid_cpqFcaAccelStatus = '.1.3.6.1.4.1.232.16.2.2.2.1.3';
|
||||
my $oid_cpqFcaAccelCondition = '.1.3.6.1.4.1.232.16.2.2.2.1.9';
|
||||
my $oid_cpqFcaAccelBatteryStatus = '.1.3.6.1.4.1.232.16.2.2.2.1.6';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqFcaAccelStatus };
|
||||
push @{$options{request}}, { oid => $oid_cpqFcaAccelCondition };
|
||||
push @{$options{request}}, { oid => $oid_cpqFcaAccelBatteryStatus };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking fca external accelerator boards");
|
||||
$self->{components}->{fcaexternalacc} = {name => 'fca external accelerator boards', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'fcaexternalacc'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqFcaAccelCondition}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqFcaAccelCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqFcaAccelStatus}, instance => $instance);
|
||||
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqFcaAccelCondition}, instance => $instance);
|
||||
my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$oid_cpqFcaAccelBatteryStatus}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'fcaexternalacc', instance => $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.",
|
||||
$instance,
|
||||
$result->{cpqFcaAccelStatus}, $result3->{cpqFcaAccelBatteryStatus},
|
||||
$result2->{cpqFcaAccelCondition}));
|
||||
my $exit = $self->get_severity(section => 'fcaexternalacc', value => $result2->{cpqFcaAccelCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("fca external accelerator boards '%s' is %s",
|
||||
$instance, $result2->{cpqFcaAccelCondition}));
|
||||
}
|
||||
$exit = $self->get_severity(section => 'fcaexternalaccbattery', value => $result3->{cpqFcaAccelBatteryStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("fca external accelerator boards '%s' battery is %s",
|
||||
$instance, $result3->{cpqFcaAccelBatteryStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,124 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::fcaexternalctl;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_fcaexternalctl_status = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'failed',
|
||||
4 => 'offline',
|
||||
5 => 'redundantPathOffline',
|
||||
6 => 'notConnected',
|
||||
);
|
||||
|
||||
my %map_fcaexternalctl_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
my %model_map = (
|
||||
1 => 'other',
|
||||
2 => 'fibreArray',
|
||||
3 => 'msa1000',
|
||||
4 => 'smartArrayClusterStorage',
|
||||
5 => 'hsg80',
|
||||
6 => 'hsv110',
|
||||
7 => 'msa500G2',
|
||||
8 => 'msa20',
|
||||
9 => 'msa1510i',
|
||||
);
|
||||
|
||||
my %map_role = (
|
||||
1 => 'other',
|
||||
2 => 'notDuplexed',
|
||||
3 => 'active',
|
||||
4 => 'backup',
|
||||
);
|
||||
|
||||
# In 'CPQFCA-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqFcaCntlrModel => { oid => '.1.3.6.1.4.1.232.16.2.2.1.1.3', map => \%model_map },
|
||||
cpqFcaCntlrStatus => { oid => '.1.3.6.1.4.1.232.16.2.2.1.1.5', map => \%map_fcaexternalctl_status },
|
||||
cpqFcaCntlrCondition => { oid => '.1.3.6.1.4.1.232.16.2.2.1.1.6', map => \%map_fcaexternalctl_condition },
|
||||
};
|
||||
my $mapping2 = {
|
||||
cpqFcaCntlrCurrentRole => { oid => '.1.3.6.1.4.1.232.16.2.2.1.1.10', map => \%map_role },
|
||||
};
|
||||
my $oid_cpqFcaCntlrEntry = '.1.3.6.1.4.1.232.16.2.2.1.1';
|
||||
my $oid_cpqFcaCntlrCurrentRole = '.1.3.6.1.4.1.232.16.2.2.1.1.10';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqFcaCntlrEntry, start => $mapping->{cpqFcaCntlrModel}->{oid}, end => $mapping->{cpqFcaCntlrCondition}->{oid} };
|
||||
push @{$options{request}}, { oid => $oid_cpqFcaCntlrCurrentRole };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking fca external controller");
|
||||
$self->{components}->{fcaexternalctl} = {name => 'fca external controllers', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'fcaexternalctl'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqFcaCntlrEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqFcaCntlrCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqFcaCntlrEntry}, instance => $instance);
|
||||
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqFcaCntlrCurrentRole}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'fcaexternalctl', instance => $instance));
|
||||
$self->{components}->{fcaexternalctl}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("fca external controller '%s' [model: %s, status: %s, role: %s] condition is %s.",
|
||||
$instance,
|
||||
$result->{cpqFcaCntlrModel}, $result->{cpqFcaCntlrStatus}, $result2->{cpqFcaCntlrCurrentRole},
|
||||
$result->{cpqFcaCntlrCondition}));
|
||||
my $exit = $self->get_severity(section => 'fcaexternalctl', value => $result->{cpqFcaCntlrCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("fca external controller '%s' is %s",
|
||||
$instance, $result->{cpqFcaCntlrCondition}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,140 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::fcahostctl;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
my %map_fcahostctl_status = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'failed',
|
||||
4 => 'shutdown',
|
||||
5 => 'loopDegraded',
|
||||
6 => 'loopFailed',
|
||||
7 => 'notConnected',
|
||||
);
|
||||
|
||||
my %map_fcahostctl_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
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',
|
||||
);
|
||||
|
||||
# In 'CPQFCA-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqFcaHostCntlrSlot => { oid => '.1.3.6.1.4.1.232.16.2.7.1.1.2' },
|
||||
cpqFcaHostCntlrModel => { oid => '.1.3.6.1.4.1.232.16.2.7.1.1.3', map => \%model_map },
|
||||
cpqFcaHostCntlrStatus => { oid => '.1.3.6.1.4.1.232.16.2.7.1.1.4', map => \%map_fcahostctl_status },
|
||||
cpqFcaHostCntlrCondition => { oid => '.1.3.6.1.4.1.232.16.2.7.1.1.5', map => \%map_fcahostctl_condition },
|
||||
};
|
||||
my $oid_cpqFcaHostCntlrEntry = '.1.3.6.1.4.1.232.16.2.7.1.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqFcaHostCntlrEntry, start => $mapping->{cpqFcaHostCntlrSlot}->{oid}, end => $mapping->{cpqFcaHostCntlrCondition}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking fca host controller");
|
||||
$self->{components}->{fcahostctl} = {name => 'fca host controllers', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'fcahostctl'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqFcaHostCntlrEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqFcaHostCntlrCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqFcaHostCntlrEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'fcahostctl', instance => $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.",
|
||||
$instance, $result->{cpqFcaHostCntlrSlot}, $result->{cpqFcaHostCntlrModel}, $result->{cpqFcaHostCntlrStatus},
|
||||
$result->{cpqFcaHostCntlrCondition}));
|
||||
my $exit = $self->get_severity(section => 'fcahostctl', value => $result->{cpqFcaHostCntlrCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("fca host controller '%s' is %s",
|
||||
$instance, $result->{cpqFcaHostCntlrCondition}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,123 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::fcaldrive;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_fcaldrive_status = (
|
||||
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 %map_fcaldrive_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
my %map_faulttol = (
|
||||
1 => 'other',
|
||||
2 => 'none',
|
||||
3 => 'mirroring',
|
||||
4 => 'dataGuard',
|
||||
5 => 'distribDataGuard',
|
||||
7 => 'advancedDataGuard',
|
||||
);
|
||||
|
||||
# In 'CPQFCA-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqFcaLogDrvFaultTol => { oid => '.1.3.6.1.4.1.232.16.2.3.1.1.3', map => \%map_faulttol },
|
||||
cpqFcaLogDrvStatus => { oid => '.1.3.6.1.4.1.232.16.2.3.1.1.4', map => \%map_fcaldrive_status },
|
||||
};
|
||||
my $mapping2 = {
|
||||
cpqFcaLogDrvCondition => { oid => '.1.3.6.1.4.1.232.16.2.3.1.1.11', map => \%map_fcaldrive_condition },
|
||||
};
|
||||
my $oid_cpqFcaLogDrvEntry = '.1.3.6.1.4.1.232.16.2.3.1.1';
|
||||
my $oid_cpqFcaLogDrvCondition = '.1.3.6.1.4.1.232.16.2.3.1.1.11';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqFcaLogDrvEntry, start => $mapping->{cpqFcaLogDrvFaultTol}->{oid}, end => $mapping->{cpqFcaLogDrvStatus}->{oid} };
|
||||
push @{$options{request}}, { oid => $oid_cpqFcaLogDrvCondition };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking fca logical drives");
|
||||
$self->{components}->{fcaldrive} = {name => 'fca logical drives', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'fcaldrive'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqFcaLogDrvCondition}})) {
|
||||
next if ($oid !~ /^$mapping2->{cpqFcaLogDrvCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqFcaLogDrvEntry}, instance => $instance);
|
||||
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqFcaLogDrvCondition}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'fcaldrive', instance => $instance));
|
||||
$self->{components}->{fcaldrive}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("fca logical drive '%s' [fault tolerance: %s, condition: %s] status is %s.",
|
||||
$instance,
|
||||
$result->{cpqFcaLogDrvFaultTol},
|
||||
$result2->{cpqFcaLogDrvCondition},
|
||||
$result->{cpqFcaLogDrvStatus}));
|
||||
my $exit = $self->get_severity(section => 'fcaldrive', value => $result->{cpqFcaLogDrvStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("fca logical drive '%s' is %s",
|
||||
$instance, $result->{cpqFcaLogDrvStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,105 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::fcapdrive;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_fcapdrive_status = (
|
||||
1 => 'other',
|
||||
2 => 'unconfigured',
|
||||
3 => 'ok',
|
||||
4 => 'threshExceeded',
|
||||
5 => 'predictiveFailure',
|
||||
6 => 'failed',
|
||||
7 => 'unsupportedDrive',
|
||||
);
|
||||
|
||||
my %map_fcapdrive_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
# In 'CPQFCA-MIB.mib'
|
||||
|
||||
my $mapping = {
|
||||
cpqFcaPhyDrvStatus => { oid => '.1.3.6.1.4.1.232.16.2.5.1.1.6', map => \%map_fcapdrive_status },
|
||||
};
|
||||
my $mapping2 = {
|
||||
cpqFcaPhyDrvCondition => { oid => '.1.3.6.1.4.1.232.16.2.5.1.1.31', map => \%map_fcapdrive_condition },
|
||||
};
|
||||
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';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqFcaLogDrvEntry, start => $mapping->{cpqFcaLogDrvFaultTol}->{oid}, end => $mapping->{cpqFcaLogDrvStatus}->{oid} };
|
||||
push @{$options{request}}, { oid => $oid_cpqFcaLogDrvCondition };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking fca physical drives");
|
||||
$self->{components}->{fcapdrive} = {name => 'fca physical drives', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'fcapdrive'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqFcaPhyDrvCondition}})) {
|
||||
next if ($oid !~ /^$mapping2->{cpqFcaPhyDrvCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqFcaPhyDrvStatus}, instance => $instance);
|
||||
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqFcaPhyDrvCondition}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'fcapdrive', instance => $instance));
|
||||
$self->{components}->{fcapdrive}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("fca physical drive '%s' [status: %s] condition is %s.",
|
||||
$instance,
|
||||
$result->{cpqFcaPhyDrvStatus},
|
||||
$result2->{cpqFcaPhyDrvCondition}));
|
||||
my $exit = $self->get_severity(section => 'fcapdrive', value => $result2->{cpqFcaPhyDrvCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => short_msg => sprintf("fca physical drive '%s' is %s",
|
||||
$instance, $result2->{cpqFcaPhyDrvCondition}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,332 +0,0 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::ida;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# 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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'dactl', instance => $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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'daacc', instance => $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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'daldrive', instance => $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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'dapdrive', instance => $instance));
|
||||
$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;
|
|
@ -1,203 +0,0 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::ide;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'idectl', instance => $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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'ideldrive', instance => $instance));
|
||||
$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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'idepdrive', instance => $instance));
|
||||
$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;
|
|
@ -0,0 +1,98 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::idectl;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
# In 'CPQIDE-MIB.mib'
|
||||
my %map_controller_status = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'failed',
|
||||
);
|
||||
|
||||
my %map_controller_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
my $mapping = {
|
||||
cpqIdeControllerModel => { oid => '.1.3.6.1.4.1.232.14.2.3.1.1.3' },
|
||||
cpqIdeControllerSlot => { oid => '.1.3.6.1.4.1.232.14.2.3.1.1.5' },
|
||||
cpqIdeControllerStatus => { oid => '.1.3.6.1.4.1.232.14.2.3.1.1.6', map => \%map_controller_status },
|
||||
cpqIdeControllerCondition => { oid => '.1.3.6.1.4.1.232.14.2.3.1.1.7', map => \%map_controller_condition },
|
||||
};
|
||||
my $oid_cpqIdeControllerEntry = '.1.3.6.1.4.1.232.14.2.3.1.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqIdeControllerEntry, start => $mapping->{cpqIdeControllerModel}->{oid}, end => $mapping->{cpqIdeControllerCondition}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking ide controllers");
|
||||
$self->{components}->{idectl} = {name => 'ide controllers', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'idectl'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqIdeControllerEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqIdeControllerCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqIdeControllerEntry}, instance => $instance);
|
||||
$result->{cpqIdeControllerModel} = centreon::plugins::misc::trim($result->{cpqIdeControllerModel});
|
||||
|
||||
next if ($self->check_exclude(section => 'idectl', instance => $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, $result->{cpqIdeControllerSlot}, $result->{cpqIdeControllerModel}, $result->{cpqIdeControllerStatus},
|
||||
$result->{cpqIdeControllerCondition}));
|
||||
my $exit = $self->get_severity(section => 'idectl', value => $result->{cpqIdeControllerCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("ide controller '%s' is %s",
|
||||
$instance, $result->{cpqIdeControllerCondition}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,96 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::ideldrive;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
# In 'CPQIDE-MIB.mib'
|
||||
my %map_ldrive_status = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'rebuilding',
|
||||
5 => 'failed',
|
||||
);
|
||||
|
||||
my %map_ldrive_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
my $mapping = {
|
||||
cpqIdeLogicalDriveStatus => { oid => '.1.3.6.1.4.1.232.14.2.6.1.1.5', map => \%map_ldrive_status },
|
||||
cpqIdeLogicalDriveCondition => { oid => '.1.3.6.1.4.1.232.14.2.6.1.1.6', map => \%map_ldrive_condition },
|
||||
};
|
||||
my $oid_cpqIdeLogicalDriveEntry = '.1.3.6.1.4.1.232.14.2.6.1.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqIdeLogicalDriveEntry, start => $mapping->{cpqIdeLogicalDriveStatus}->{oid}, end => $mapping->{cpqIdeLogicalDriveCondition}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking ide logical drives");
|
||||
$self->{components}->{ideldrive} = {name => 'ide logical drives', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'ideldrive'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqIdeLogicalDriveEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqIdeLogicalDriveCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqIdeLogicalDriveEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'ideldrive', instance => $instance));
|
||||
$self->{components}->{ideldrive}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("ide logical drive '%s' is %s [condition: %s]",
|
||||
$instance, $result->{cpqIdeLogicalDriveStatus}, $result->{cpqIdeLogicalDriveCondition}));
|
||||
my $exit = $self->get_severity(section => 'ideldrive', value => $result->{cpqIdeLogicalDriveStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("ide logical drive '%s' is %s",
|
||||
$instance, $result->{cpqIdeLogicalDriveStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,97 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::idepdrive;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
# In 'CPQIDE-MIB.mib'
|
||||
my %map_pdrive_status = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'smartError',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
my %map_pdrive_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
my $mapping = {
|
||||
cpqIdeAtaDiskStatus => { oid => '.1.3.6.1.4.1.232.14.2.4.1.1.6', map => \%map_pdrive_status },
|
||||
cpqIdeAtaDiskCondition => { oid => '.1.3.6.1.4.1.232.14.2.4.1.1.7', map => \%map_pdrive_condition },
|
||||
};
|
||||
my $oid_cpqIdeAtaDiskEntry = '.1.3.6.1.4.1.232.14.2.4.1.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqIdeAtaDiskEntry, start => $mapping->{cpqIdeAtaDiskStatus}->{oid}, end => $mapping->{cpqIdeAtaDiskCondition}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking ide physical drives");
|
||||
$self->{components}->{idepdrive} = {name => 'ide physical drives', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'idepdrive'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqIdeAtaDiskEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqIdeAtaDiskCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqIdeAtaDiskEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'idepdrive', instance => $instance));
|
||||
$self->{components}->{idepdrive}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("ide physical drive '%s' [status: %s] condition is %s.",
|
||||
$instance,
|
||||
$result->{cpqIdeAtaDiskStatus},
|
||||
$result->{cpqIdeAtaDiskCondition}));
|
||||
my $exit = $self->get_severity(section => 'idepdrive', value => $result->{cpqIdeAtaDiskCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("ide physical drive '%s' is %s",
|
||||
$instance, $result->{cpqIdeAtaDiskCondition}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,111 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::lnic;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
my %map_lnic_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
my %map_lnic_status = (
|
||||
1 => "unknown",
|
||||
2 => "ok",
|
||||
3 => "primaryFailed",
|
||||
4 => "standbyFailed",
|
||||
5 => "groupFailed",
|
||||
6 => "redundancyReduced",
|
||||
7 => "redundancyLost",
|
||||
);
|
||||
|
||||
# In MIB 'CPQNIC-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqNicIfLogMapDescription => { oid => '.1.3.6.1.4.1.232.18.2.2.1.1.3' },
|
||||
};
|
||||
my $mapping2 = {
|
||||
cpqNicIfLogMapAdapterCount => { oid => '.1.3.6.1.4.1.232.18.2.2.1.1.5' },
|
||||
};
|
||||
my $mapping3 = {
|
||||
cpqNicIfLogMapCondition => { oid => '.1.3.6.1.4.1.232.18.2.2.1.1.10', map => \%map_lnic_condition },
|
||||
cpqNicIfLogMapStatus => { oid => '.1.3.6.1.4.1.232.18.2.2.1.1.11', map => \%map_lnic_status },
|
||||
};
|
||||
my $oid_cpqNicIfLogMapEntry = '.1.3.6.1.4.1.232.18.2.2.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';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqNicIfLogMapEntry, start => $mapping->{cpqNicIfLogMapCondition}->{oid}, end => $mapping->{cpqNicIfLogMapStatus}->{oid} };
|
||||
push @{$options{request}}, { oid => $oid_cpqNicIfLogMapDescription };
|
||||
push @{$options{request}}, { oid => $cpqNicIfLogMapAdapterCount };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking logical nics");
|
||||
$self->{components}->{lnic} = {name => 'logical nics', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'lnic'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqNicIfLogMapEntry}})) {
|
||||
next if ($oid !~ /^$mapping3->{cpqNicIfLogMapCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqNicIfLogMapDescription}, instance => $instance);
|
||||
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqNicIfLogMapAdapterCount}, instance => $instance);
|
||||
my $result3 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqNicIfLogMapEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'lnic', instance => $instance));
|
||||
$self->{components}->{lnic}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => printf("logical nic '%s' [adapter count: %s, description: %s, status: %s] condition is %s.",
|
||||
$instance, $result->{cpqNicIfLogMapAdapterCount}, centreon::plugins::misc::trim($result->{cpqNicIfLogMapDescription}),
|
||||
$result3->{cpqNicIfLogMapStatus},
|
||||
$result3->{cpqNicIfLogMapCondition}));
|
||||
my $exit = $self->get_severity(section => 'lnic', value => $result3->{cpqNicIfLogMapCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("logical nic '%s' is %s (%s)",
|
||||
$nic_index, $result3->{cpqNicIfLogMapCondition}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,183 +0,0 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::network;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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;
|
||||
|
||||
next if ($self->check_exclude(section => 'pnic', instance => $instance));
|
||||
$self->{components}->{pnic}->{total}++;
|
||||
|
||||
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->{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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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;
|
||||
|
||||
next if ($self->check_exclude(section => 'lnic', instance => $instance));
|
||||
$self->{components}->{lnic}->{total}++;
|
||||
|
||||
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->{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;
|
|
@ -38,74 +38,67 @@ package hardware::server::hp::proliant::snmp::mode::components::pc;
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %conditions = (
|
||||
1 => ['other', 'CRITICAL'],
|
||||
2 => ['ok', 'OK'],
|
||||
3 => ['degraded', 'WARNING'],
|
||||
4 => ['failed', 'CRITICAL']
|
||||
my %map_pc_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
my %present_map = (
|
||||
my %map_present = (
|
||||
1 => 'other',
|
||||
2 => 'absent',
|
||||
3 => 'present',
|
||||
);
|
||||
|
||||
my %redundant_map = (
|
||||
my %map_redundant = (
|
||||
1 => 'other',
|
||||
2 => 'not redundant',
|
||||
3 => 'redundant',
|
||||
);
|
||||
|
||||
# In MIB 'CPQHLTH-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqHePwrConvPresent => { oid => '.1.3.6.1.4.1.232.6.2.13.3.1.3', map => \%map_present },
|
||||
cpqHePwrConvRedundant => { oid => '.1.3.6.1.4.1.232.6.2.13.3.1.6', map => \%map_redundant },
|
||||
cpqHePwrConvRedundantGroupId => { oid => '.1.3.6.1.4.1.232.6.2.13.3.1.7' },
|
||||
cpqHePwrConvCondition => { oid => '.1.3.6.1.4.1.232.6.2.13.3.1.8', map => \%map_pc_condition },
|
||||
};
|
||||
my $oid_cpqHePowerConverterEntry = '.1.3.6.1.4.1.232.6.2.13.3.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqHePowerConverterEntry, start => $mapping->{cpqHePwrConvPresent}->{oid}, end => $mapping->{cpqHePwrConvCondition}->{oid} };
|
||||
}
|
||||
|
||||
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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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)) {
|
||||
# Chassis + index
|
||||
$key =~ /(\d+)\.(\d+)$/;
|
||||
my $oid_end = $1 . '.' . $2;
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqHePowerConverterEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqHePwrConvPresent}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqHePowerConverterEntry}, instance => $instance);
|
||||
|
||||
next if ($present_map{$result->{$key}} ne 'present' &&
|
||||
$self->absent_problem(section => 'pc', instance => $1 . '.' . $2));
|
||||
next if ($self->check_exclude(section => 'pc', instance => $instance));
|
||||
next if ($result->{cpqHePwrConvPresent} !~ /present/i &&
|
||||
$self->absent_problem(section => 'pc', instance => $instance));
|
||||
|
||||
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';
|
||||
|
||||
next if ($self->check_exclude(section => 'pc', instance => $pc_chassis . '.' . $pc_index));
|
||||
$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
|
||||
$self->{output}->output_add(long_msg => sprintf("powerconverter '%s' status is %s [redundance: %s, redundant group: %s].",
|
||||
$instance, $result->{cpqHePwrConvCondition},
|
||||
$result->{cpqHePwrConvRedundant}, $result->{cpqHePwrConvRedundantGroupId}
|
||||
));
|
||||
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]));
|
||||
my $exit = $self->get_severity(section => 'pc', value => $result->{cpqHePwrConvCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("powerconverter '%s' status is %s",
|
||||
$instance, $result->{cpqHePwrConvCondition}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::pnic;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_pnic_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
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_nic_duplex = (
|
||||
1 => "unknown",
|
||||
2 => "half",
|
||||
3 => "full",
|
||||
);
|
||||
# In MIB 'CPQNIC-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqNicIfPhysAdapterRole => { oid => '.1.3.6.1.4.1.232.18.2.3.1.1.3', map => \%map_pnic_role },
|
||||
};
|
||||
my $mapping2 = {
|
||||
cpqNicIfPhysAdapterDuplexState => { oid => '.1.3.6.1.4.1.232.18.2.3.1.1.11', map => \%map_nic_duplex },
|
||||
cpqNicIfPhysAdapterCondition => { oid => '.1.3.6.1.4.1.232.18.2.3.1.1.12', map => \%map_pnic_condition },
|
||||
cpqNicIfPhysAdapterState => { oid => '.1.3.6.1.4.1.232.18.2.3.1.1.13', map => \%map_nic_state },
|
||||
cpqNicIfPhysAdapterStatus => { oid => '.1.3.6.1.4.1.232.18.2.3.1.1.14', map => \%map_pnic_status },
|
||||
};
|
||||
my $oid_cpqNicIfPhysAdapterEntry = '.1.3.6.1.4.1.232.18.2.3.1.1';
|
||||
my $oid_cpqNicIfPhysAdapterRole = '.1.3.6.1.4.1.232.18.2.3.1.1.3';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqNicIfPhysAdapterEntry, start => $mapping->{cpqNicIfPhysAdapterDuplexState}->{oid}, end => $mapping->{cpqNicIfPhysAdapterStatus}->{oid} };
|
||||
push @{$options{request}}, { oid => $oid_cpqNicIfPhysAdapterRole };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking physical nics");
|
||||
$self->{components}->{pnic} = {name => 'physical nics', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'pnic'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqNicIfPhysAdapterEntry}})) {
|
||||
next if ($oid !~ /^$mapping2->{cpqNicIfPhysAdapterCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqNicIfPhysAdapterRole}, instance => $instance);
|
||||
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqNicIfPhysAdapterEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'pnic', instance => $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.",
|
||||
$instance, $result2->{cpqNicIfPhysAdapterDuplexState}, $result->{cpqNicIfPhysAdapterRole},
|
||||
$result2->{cpqNicIfPhysAdapterState}, $result2->{cpqNicIfPhysAdapterStatus},
|
||||
$result2->{cpqNicIfPhysAdapterCondition}));
|
||||
my $exit = $self->get_severity(section => 'pnic', value => $result2->{cpqNicIfPhysAdapterCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("physical nic '%s' is %s",
|
||||
$instance, $result2->{cpqNicIfPhysAdapterCondition}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -38,26 +38,26 @@ package hardware::server::hp::proliant::snmp::mode::components::psu;
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %conditions = (
|
||||
1 => ['other', 'CRITICAL'],
|
||||
2 => ['ok', 'OK'],
|
||||
3 => ['degraded', 'WARNING'],
|
||||
4 => ['failed', 'CRITICAL']
|
||||
my %map_psu_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
my %present_map = (
|
||||
my %map_present = (
|
||||
1 => 'other',
|
||||
2 => 'absent',
|
||||
3 => 'present',
|
||||
);
|
||||
|
||||
my %redundant_map = (
|
||||
my %map_redundant = (
|
||||
1 => 'other',
|
||||
2 => 'not redundant',
|
||||
3 => 'redundant',
|
||||
);
|
||||
|
||||
my %psustatus = (
|
||||
my %map_psu_status = (
|
||||
1 => 'noError',
|
||||
2 => 'generalFailure',
|
||||
3 => 'bistFailure',
|
||||
|
@ -76,74 +76,64 @@ my %psustatus = (
|
|||
16 => 'calibrationTableInvalid',
|
||||
);
|
||||
|
||||
# In MIB 'CPQHLTH-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqHeFltTolPowerSupplyPresent => { oid => '.1.3.6.1.4.1.232.6.2.9.3.1.3', map => \%map_present },
|
||||
cpqHeFltTolPowerSupplyCondition => { oid => '.1.3.6.1.4.1.232.6.2.9.3.1.4', map => \%map_psu_condition },
|
||||
cpqHeFltTolPowerSupplyStatus => { oid => '.1.3.6.1.4.1.232.6.2.9.3.1.5', map => \%map_psu_status },
|
||||
cpqHeFltTolPowerSupplyMainVoltage => { oid => '.1.3.6.1.4.1.232.6.2.9.3.1.6' },
|
||||
cpqHeFltTolPowerSupplyCapacityUsed => { oid => '.1.3.6.1.4.1.232.6.2.9.3.1.7' },
|
||||
cpqHeFltTolPowerSupplyCapacityMaximum => { oid => '.1.3.6.1.4.1.232.6.2.9.3.1.8' },
|
||||
cpqHeFltTolPowerSupplyRedundant => { oid => '.1.3.6.1.4.1.232.6.2.9.3.1.9' },
|
||||
};
|
||||
my $mapping2 = {
|
||||
cpqHeFltTolPowerSupplyRedundantPartner => { oid => '.1.3.6.1.4.1.232.6.2.9.3.1.17' },
|
||||
};
|
||||
my $oid_cpqHeFltTolPowerSupplyEntry = '.1.3.6.1.4.1.232.6.2.9.3.1';
|
||||
my $oid_cpqHeFltTolPowerSupplyRedundantPartner = '.1.3.6.1.4.1.232.6.2.9.3.1.17';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqHeFltTolPowerSupplyEntry, start => $mapping->{cpqHeFltTolPowerSupplyPresent}->{oid}, end => $mapping->{cpqHeFltTolPowerSupplyRedundant}->{oid} };
|
||||
push @{$options{request}}, { oid => $oid_cpqHeFltTolPowerSupplyRedundantPartner };
|
||||
}
|
||||
|
||||
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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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)) {
|
||||
# Chassis + Bay
|
||||
$key =~ /(\d+)\.(\d+)$/;
|
||||
my $oid_end = $1 . '.' . $2;
|
||||
|
||||
next if ($present_map{$result->{$key}} ne 'present' &&
|
||||
$self->absent_problem(section => 'psu', instance => $1 . '.' . $2));
|
||||
|
||||
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 . '.' . $_};
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqHeFltTolPowerSupplyEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqHeFltTolPowerSupplyPresent}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqHeFltTolPowerSupplyEntry}, instance => $instance);
|
||||
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqHeFltTolPowerSupplyRedundantPartner}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'psu', instance => $psu_chassis . '.' . $psu_bay));
|
||||
next if ($self->check_exclude(section => 'psu', instance => $instance));
|
||||
next if ($result->{cpqHeFltTolPowerSupplyPresent} !~ /present/i &&
|
||||
$self->absent_problem(section => 'psu', instance => $instance));
|
||||
$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}
|
||||
$self->{output}->output_add(long_msg => sprintf("powersupply '%s' status is %s [redundance: %s, redundant partner: %s] (status %s).",
|
||||
$instance, $result->{cpqHeFltTolPowerSupplyCondition},
|
||||
$result->{cpqHeFltTolPowerSupplyRedundant}, $result2->{cpqHeFltTolPowerSupplyRedundantPartner},
|
||||
$result->{cpqHeFltTolPowerSupplyStatus}
|
||||
));
|
||||
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]));
|
||||
my $exit = $self->get_severity(section => 'psu', value => $result->{cpqHeFltTolPowerSupplyCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("powersupply '%s' status is %s",
|
||||
$instance, $result->{cpqHeFltTolPowerSupplyCondition}));
|
||||
}
|
||||
|
||||
$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);
|
||||
$self->{output}->perfdata_add(label => "psu_power_" . $instance, unit => 'W',
|
||||
value => $result->{cpqHeFltTolPowerSupplyCapacityUsed},
|
||||
critical => $result->{cpqHeFltTolPowerSupplyCapacityMaximum});
|
||||
$self->{output}->perfdata_add(label => "psu__voltage" . $instance, unit => 'V',
|
||||
value => $result->{cpqHeFltTolPowerSupplyMainVoltage});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,206 +0,0 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::sas;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# 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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'sasctl', instance => $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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'sasldrive', instance => $instance));
|
||||
$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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'saspdrive', instance => $instance));
|
||||
$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;
|
|
@ -0,0 +1,96 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::sasctl;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
my %map_controller_status = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'failed',
|
||||
);
|
||||
|
||||
my %map_controller_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
# In 'CPQSCSI-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqSasHbaStatus => { oid => '.1.3.6.1.4.1.232.5.5.1.1.1.4', map => \%map_controller_status },
|
||||
cpqSasHbaCondition => { oid => '.1.3.6.1.4.1.232.5.5.1.1.1.5', map => \%map_controller_condition },
|
||||
cpqSasHbaSlot => { oid => '.1.3.6.1.4.1.232.5.5.1.1.1.6' },
|
||||
};
|
||||
my $oid_cpqSasHbaEntry = '.1.3.6.1.4.1.232.5.5.1.1.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqSasHbaEntry, start => $mapping->{cpqSasHbaStatus}->{oid}, end => $mapping->{cpqSasHbaSlot}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking sas controllers");
|
||||
$self->{components}->{sasctl} = {name => 'sas controllers', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'sasctl'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqSasHbaEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqSasHbaCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqSasHbaEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'sasctl', instance => $instance));
|
||||
$self->{components}->{sasctl}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("sas controller '%s' [slot: %s, status: %s] condition is %s.",
|
||||
$instance, $result->{cpqSasHbaSlot}, $result->{cpqSasHbaStatus},
|
||||
$result->{cpqSasHbaCondition}));
|
||||
my $exit = $self->get_severity(section => 'sasctl', value => $result->{cpqSasHbaCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("sas controller '%s' is %s",
|
||||
$instance, $result->{cpqSasHbaCondition}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,98 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::sasldrive;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_ldrive_status = (
|
||||
1 => "other",
|
||||
2 => "ok",
|
||||
3 => "degraded",
|
||||
4 => "rebuilding",
|
||||
5 => "failed",
|
||||
6 => "offline",
|
||||
);
|
||||
|
||||
my %map_ldrive_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
# In 'CPQSCSI-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqSasLogDrvStatus => { oid => '.1.3.6.1.4.1.232.5.5.3.1.1.4', map => \%map_ldrive_status },
|
||||
cpqSasLogDrvCondition => { oid => '.1.3.6.1.4.1.232.5.5.3.1.1.5', map => \%map_ldrive_condition },,
|
||||
};
|
||||
my $oid_cpqSasLogDrvEntry = '.1.3.6.1.4.1.232.5.5.3.1.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqSasLogDrvEntry, start => $mapping->{cpqSasLogDrvStatus}->{oid}, end => $mapping->{cpqSasLogDrvCondition}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking sas logical drives");
|
||||
$self->{components}->{sasldrive} = {name => 'sas logical drives', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'sasldrive'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqSasLogDrvEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqSasLogDrvStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqSasLogDrvEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'sasldrive', instance => $instance));
|
||||
$self->{components}->{sasldrive}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("sas logical drive '%s' status is %s [condition: %s].",
|
||||
$instance,
|
||||
$result->{cpqSasLogDrvStatus},
|
||||
$result->{cpqSasLogDrvCondition}));
|
||||
my $exit = $self->get_severity(section => 'sasldrive', value => $result->{cpqSasLogDrvStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("sas logical drive '%s' is %s",
|
||||
$instance, $result->{cpqSasLogDrvStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,101 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::saspdrive;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_pdrive_status = (
|
||||
1 => "other",
|
||||
2 => "ok",
|
||||
3 => "predictiveFailure",
|
||||
4 => "offline",
|
||||
5 => "failed",
|
||||
6 => "missingWasOk",
|
||||
7 => "missingWasPredictiveFailure",
|
||||
8 => "missingWasOffline",
|
||||
9 => "missingWasFailed",
|
||||
);
|
||||
|
||||
my %map_pdrive_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
# In 'CPQSCSI-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqSasPhyDrvStatus => { oid => '.1.3.6.1.4.1.232.5.5.2.1.1.5', map => \%map_pdrive_status },
|
||||
cpqSasPhyDrvCondition => { oid => '.1.3.6.1.4.1.232.5.5.2.1.1.6', map => \%map_pdrive_condition },
|
||||
};
|
||||
my $oid_cpqSasPhyDrvEntry = '.1.3.6.1.4.1.232.5.5.2.1.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqSasPhyDrvEntry, start => $mapping->{cpqSasPhyDrvStatus}->{oid}, end => $mapping->{cpqSasPhyDrvCondition}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking sas physical drives");
|
||||
$self->{components}->{saspdrive} = {name => 'sas physical drives', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'saspdrive'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqSasPhyDrvEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqSasPhyDrvCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqSasPhyDrvEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'saspdrive', instance => $instance));
|
||||
$self->{components}->{saspdrive}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("sas physical drive '%s' [status: %s] condition is %s.",
|
||||
$instance,
|
||||
$result->{cpqSasPhyDrvStatus},
|
||||
$result->{cpqSasPhyDrvCondition}));
|
||||
my $exit = $self->get_severity(section => 'saspdrive', value => $result->{cpqSasPhyDrvCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("sas physical drive '%s' is %s",
|
||||
$instance, $result->{cpqSasPhyDrvCondition}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,216 +0,0 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::scsi;
|
||||
# In 'CPQSCSI-MIB.mib'
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'scsictl', instance => $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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'scsildrive', instance => $instance));
|
||||
$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, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
|
||||
next if ($self->check_exclude(section => 'scsipdrive', instance => $instance));
|
||||
$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;
|
|
@ -0,0 +1,101 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::scsictl;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
my %map_controller_status = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'failed',
|
||||
);
|
||||
|
||||
my %map_controller_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
# In 'CPQSCSI-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqScsiCntlrSlot => { oid => '.1.3.6.1.4.1.232.5.2.2.1.1.6' },
|
||||
cpqScsiCntlrStatus => { oid => '.1.3.6.1.4.1.232.5.2.2.1.1.7', map => \%map_controller_status },
|
||||
};
|
||||
my $mapping2 = {
|
||||
cpqScsiCntlrCondition => { oid => '.1.3.6.1.4.1.232.5.2.2.1.1.12', map => \%map_controller_condition },
|
||||
};
|
||||
my $oid_cpqScsiCntlrEntry = '.1.3.6.1.4.1.232.5.2.2.1.1';
|
||||
my $oid_cpqScsiCntlrCondition = '.1.3.6.1.4.1.232.5.2.2.1.1.12';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqScsiCntlrEntry, start => $mapping->{cpqScsiCntlrSlot}->{oid}, end => $mapping->{cpqScsiCntlrStatus}->{oid} };
|
||||
push @{$options{request}}, { oid => $oid_cpqScsiCntlrCondition };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking scsi controllers");
|
||||
$self->{components}->{scsictl} = {name => 'scsi controllers', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'scsictl'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqScsiCntlrEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqScsiCntlrStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqScsiCntlrEntry}, instance => $instance);
|
||||
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqScsiCntlrCondition}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'scsictl', instance => $instance));
|
||||
$self->{components}->{scsictl}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("scsi controller '%s' [slot: %s, status: %s] condition is %s.",
|
||||
$instance, $result->{cpqScsiCntlrSlot}, $result->{cpqScsiCntlrStatus},
|
||||
$result2->{cpqScsiCntlrCondition}));
|
||||
my $exit = $self->get_severity(section => 'scsictl', value => $result2->{cpqScsiCntlrCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("scsi controller '%s' is %s",
|
||||
$instance, $result2->{cpqScsiCntlrCondition}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,110 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::scsildrive;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
my %map_ldrive_status = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'failed',
|
||||
4 => 'unconfigured',
|
||||
5 => 'recovering',
|
||||
6 => 'readyForRebuild',
|
||||
7 => 'rebuilding',
|
||||
8 => 'wrongDrive',
|
||||
9 => 'badConnect',
|
||||
10 => 'degraded',
|
||||
11 => 'disabled',
|
||||
);
|
||||
|
||||
my %map_ldrive_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
# In 'CPQSCSI-MIB.mib'
|
||||
|
||||
my $mapping = {
|
||||
cpqScsiLogDrvStatus => { oid => '.1.3.6.1.4.1.232.5.2.3.1.1.5', map => \%map_ldrive_status },
|
||||
};
|
||||
my $mapping2 = {
|
||||
cpqScsiLogDrvCondition => { oid => '.1.3.6.1.4.1.232.5.2.3.1.1.8', map => \%map_ldrive_condition },
|
||||
};
|
||||
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';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $cpqScsiLogDrvStatus };
|
||||
push @{$options{request}}, { oid => $cpqScsiLogDrvCondition };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking scsi logical drives");
|
||||
$self->{components}->{scsildrive} = {name => 'scsi logical drives', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'scsildrive'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqScsiLogDrvCondition}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqScsiLogDrvCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqScsiLogDrvStatus}, instance => $instance);
|
||||
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqScsiLogDrvCondition}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'scsildrive', instance => $instance));
|
||||
$self->{components}->{scsildrive}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("scsi logical drive '%s' status is %s [condition: %s].",
|
||||
$instance,
|
||||
$result2->{oid_cpqScsiLogDrvStatus},
|
||||
$result->{oid_cpqScsiLogDrvCondition}));
|
||||
my $exit = $self->get_severity(section => 'scsildrive', value => $result2->{oid_cpqScsiLogDrvStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("scsi logical drive '%s' is %s",
|
||||
$instance, $result2->{oid_cpqScsiLogDrvStatus}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -0,0 +1,111 @@
|
|||
################################################################################
|
||||
# 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::hp::proliant::snmp::mode::components::scsipdrive;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
|
||||
my %map_pdrive_status = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'failed',
|
||||
4 => 'notConfigured',
|
||||
5 => 'badCable',
|
||||
6 => 'missingWasOk',
|
||||
7 => 'missingWasFailed',
|
||||
8 => 'predictiveFailure',
|
||||
9 => 'missingWasPredictiveFailure',
|
||||
10 => 'offline',
|
||||
11 => 'missingWasOffline',
|
||||
12 => 'hardError',
|
||||
);
|
||||
|
||||
my %map_pdrive_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
|
||||
# In 'CPQSCSI-MIB.mib'
|
||||
|
||||
my $mapping = {
|
||||
cpqScsiPhyDrvStatus => { oid => '.1.3.6.1.4.1.232.5.2.4.1.1.9', map => \%map_pdrive_status },
|
||||
};
|
||||
my $mapping2 = {
|
||||
cpqScsiPhyDrvCondition => { oid => '.1.3.6.1.4.1.232.5.2.4.1.1.26', map => \%map_pdrive_condition },
|
||||
};
|
||||
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';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqScsiPhyDrvStatus };
|
||||
push @{$options{request}}, { oid => $oid_cpqScsiPhyDrvCondition };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking scsi physical drives");
|
||||
$self->{components}->{scsipdrive} = {name => 'scsi physical drives', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => 'scsipdrive'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqScsiPhyDrvCondition}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqScsiPhyDrvCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqScsiPhyDrvStatus}, instance => $instance);
|
||||
my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_cpqScsiPhyDrvCondition}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'scsipdrive', instance => $instance));
|
||||
$self->{components}->{scsipdrive}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("scsi physical drive '%s' [status: %s] condition is %s.",
|
||||
$instance,
|
||||
$result->{cpqScsiPhyDrvStatus},
|
||||
$result2->{cpqScsiPhyDrvCondition}));
|
||||
my $exit = $self->get_severity(section => 'scsipdrive', value => $result2->{cpqScsiPhyDrvCondition});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("scsi physical drive '%s' is %s",
|
||||
$instance, $result2->{cpqScsiPhyDrvCondition}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
|
@ -38,7 +38,13 @@ package hardware::server::hp::proliant::snmp::mode::components::temperature;
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %location_map = (
|
||||
my %map_temperature_condition = (
|
||||
1 => 'other',
|
||||
2 => 'ok',
|
||||
3 => 'degraded',
|
||||
4 => 'failed',
|
||||
);
|
||||
my %map_location = (
|
||||
1 => "other",
|
||||
2 => "unknown",
|
||||
3 => "system",
|
||||
|
@ -59,60 +65,63 @@ my %location_map = (
|
|||
18 => "virtual",
|
||||
);
|
||||
|
||||
my %conditions = (
|
||||
1 => ['other', 'CRITICAL'],
|
||||
2 => ['ok', 'OK'],
|
||||
3 => ['degraded', 'WARNING'],
|
||||
4 => ['failed', 'CRITICAL']
|
||||
);
|
||||
# In MIB 'CPQSTDEQ-MIB.mib'
|
||||
my $mapping = {
|
||||
cpqHeTemperatureLocale => { oid => '.1.3.6.1.4.1.232.6.2.6.8.1.3', map => \%map_location },
|
||||
cpqHeTemperatureCelsius => { oid => '.1.3.6.1.4.1.232.6.2.6.8.1.4' },
|
||||
cpqHeTemperatureThreshold => { oid => '.1.3.6.1.4.1.232.6.2.6.8.1.5' },
|
||||
cpqHeTemperatureCondition => { oid => '.1.3.6.1.4.1.232.6.2.6.8.1.6', map => \%map_temperature_condition },
|
||||
};
|
||||
my $oid_cpqHeTemperatureEntry = '.1.3.6.1.4.1.232.6.2.6.8.1';
|
||||
|
||||
sub load {
|
||||
my (%options) = @_;
|
||||
|
||||
push @{$options{request}}, { oid => $oid_cpqHeTemperatureEntry, start => $mapping->{cpqHeTemperatureLocale}->{oid}, end => $mapping->{cpqHeTemperatureCondition}->{oid} };
|
||||
}
|
||||
|
||||
sub check {
|
||||
my ($self) = @_;
|
||||
# In MIB 'CPQSTDEQ-MIB.mib'
|
||||
|
||||
$self->{output}->output_add(long_msg => "Checking temperatures");
|
||||
$self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0};
|
||||
return if ($self->check_exclude(section => '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};
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqHeTemperatureEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{cpqHeTemperatureCondition}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqHeTemperatureEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_exclude(section => 'temperature', instance => $temp_chassis . '.' . $temp_index));
|
||||
next if ($self->check_exclude(section => 'temperature', instance => $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(long_msg => sprintf("'%s' %s temperature is %dC (%d max) (status is %s).",
|
||||
$instance, $result->{cpqHeTemperatureLocale}, $result->{cpqHeTemperatureCelsius},
|
||||
$result->{cpqHeTemperatureThreshold},
|
||||
$result->{cpqHeTemperatureCondition}));
|
||||
my $exit = $self->get_severity(section => 'temperature', value => $result->{cpqHeTemperatureCondition});
|
||||
if (!$self->{output}->is_status(value => $temperature, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
$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]));
|
||||
short_msg => sprintf("temperature '%s' %s status is %s",
|
||||
$instance, $result->{cpqHeTemperatureLocale}, $result->{cpqHeTemperatureCondition}));
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(label => "temp_" . $temp_index . "_" . $location_map{$temp_locale}, unit => 'C',
|
||||
value => $temp_current,
|
||||
critical => (($temp_threshold != -1) ? $temp_threshold : -1));
|
||||
if (defined($result->{cpqHeTemperatureCelsius}) && $result->{cpqHeTemperatureCelsius} != -1) {
|
||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{cpqHeTemperatureCelsius});
|
||||
if ($checked == 0) {
|
||||
my $warn_th = '';
|
||||
my $crit_th = $result->{cpqHeTemperatureThreshold} != -1 ? $result->{cpqHeTemperatureThreshold} : '';
|
||||
$self->{perfdata}->threshold_validate(label => 'warning-temperature-instance-' . $instance, value => $warn_th);
|
||||
$self->{perfdata}->threshold_validate(label => 'critical-temperature-instance-' . $instance, value => $crit_th);
|
||||
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-temperature-instance-' . $instance);
|
||||
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $instance);
|
||||
}
|
||||
$self->{output}->perfdata_add(label => "temp_" . $instance . "_" . $result->{cpqHeTemperatureLocale}, unit => 'C',
|
||||
value => $result->{cpqHeTemperatureCelsius},
|
||||
warning => $warn,
|
||||
critical => $crit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,17 +40,208 @@ use base qw(centreon::plugins::mode);
|
|||
use strict;
|
||||
use warnings;
|
||||
use centreon::plugins::misc;
|
||||
use hardware::server::hp::proliant::snmp::mode::components::cpu;
|
||||
use hardware::server::hp::proliant::snmp::mode::components::psu;
|
||||
use hardware::server::hp::proliant::snmp::mode::components::pc;
|
||||
use hardware::server::hp::proliant::snmp::mode::components::fan;
|
||||
use hardware::server::hp::proliant::snmp::mode::components::temperature;
|
||||
use hardware::server::hp::proliant::snmp::mode::components::network;
|
||||
use hardware::server::hp::proliant::snmp::mode::components::ida;
|
||||
use hardware::server::hp::proliant::snmp::mode::components::fca;
|
||||
use hardware::server::hp::proliant::snmp::mode::components::ide;
|
||||
use hardware::server::hp::proliant::snmp::mode::components::sas;
|
||||
use hardware::server::hp::proliant::snmp::mode::components::scsi;
|
||||
|
||||
my $thresholds = {
|
||||
cpu => [
|
||||
['unknown', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
['disabled', 'OK'],
|
||||
],
|
||||
idectl => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
ideldrive => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['rebuilding', 'WARNING'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
idepdrive => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
pc => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
psu => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
sasctl => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
sasldrive => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['rebuilding', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
['offline', 'CRITICAL'],
|
||||
],
|
||||
saspdrive => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
scsictl => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
scsildrive => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
['unconfigured', 'OK'],
|
||||
['recovering', 'WARNING'],
|
||||
['readyForRebuild', 'WARNING'],
|
||||
['rebuilding', 'WARNING'],
|
||||
['wrongDrive', 'CRITICAL'],
|
||||
['badConnect', 'CRITICAL'],
|
||||
['disabled', 'OK'],
|
||||
],
|
||||
scsipdrive => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
fcahostctl => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
fcaexternalctl => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
fcaexternalacc => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
fcaexternalaccbattery => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
['recharging', 'WARNING'],
|
||||
['not present', 'OK'],
|
||||
],
|
||||
fcaldrive => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['failed', 'CRITICAL'],
|
||||
['rebuilding', 'WARNING'],
|
||||
['expanding', 'WARNING'],
|
||||
['recovering', 'WARNING'],
|
||||
['unconfigured', 'OK'],
|
||||
['readyForRebuild', 'WARNING'],
|
||||
['wrongDrive', 'CRITICAL'],
|
||||
['badConnect', 'CRITICAL'],
|
||||
['overheating', 'CRITICAL'],
|
||||
['notAvailable', 'WARNING'],
|
||||
['hardError', 'CRITICAL'],
|
||||
['queuedForExpansion', 'WARNING'],
|
||||
['shutdown', 'WARNING'],
|
||||
],
|
||||
fcapdrive => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
dactl => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
daacc => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
daaccbattery => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
['recharging', 'WARNING'],
|
||||
['not present', 'OK'],
|
||||
],
|
||||
daldrive => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['failed', 'CRITICAL'],
|
||||
['rebuilding', 'WARNING'],
|
||||
['expanding', 'WARNING'],
|
||||
['recovering', 'WARNING'],
|
||||
['unconfigured', 'OK'],
|
||||
['readyForRebuild', 'WARNING'],
|
||||
['wrongDrive', 'CRITICAL'],
|
||||
['badConnect', 'CRITICAL'],
|
||||
['overheating', 'CRITICAL'],
|
||||
['notAvailable', 'WARNING'],
|
||||
['hardError', 'CRITICAL'],
|
||||
['queuedForExpansion', 'WARNING'],
|
||||
['shutdown', 'WARNING'],
|
||||
],
|
||||
dapdrive => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
fan => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
pnic => [
|
||||
['other', 'UNKNOWN'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
lnic => [
|
||||
['other', 'OK'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
temperature => [
|
||||
['other', 'OK'],
|
||||
['ok', 'OK'],
|
||||
['degraded', 'WARNING'],
|
||||
['failed', 'CRITICAL'],
|
||||
],
|
||||
};
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
|
@ -62,8 +253,11 @@ sub new {
|
|||
{
|
||||
"exclude:s" => { name => 'exclude' },
|
||||
"absent-problem:s" => { name => 'absent' },
|
||||
"component:s" => { name => 'component', default => 'all' },
|
||||
"component:s" => { name => 'component', default => '.*' },
|
||||
"no-component:s" => { name => 'no_component' },
|
||||
"threshold-overload:s@" => { name => 'threshold_overload' },
|
||||
"warning:s@" => { name => 'warning' },
|
||||
"critical:s@" => { name => 'critical' },
|
||||
});
|
||||
|
||||
$self->{product_name} = undef;
|
||||
|
@ -86,122 +280,50 @@ sub check_options {
|
|||
$self->{no_components} = 'critical';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub global {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->get_system_information();
|
||||
hardware::server::hp::proliant::snmp::mode::components::cpu::check($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::psu::check($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::pc::check($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::fan::check($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::temperature::check($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::network::physical_nic($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::network::logical_nic($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::ida::array_controller($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::ida::array_accelerator($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::ida::logical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::ida::physical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::fca::host_array_controller($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::fca::external_array_controller($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::fca::external_array_accelerator($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::fca::logical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::fca::physical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::ide::controller($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::ide::logical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::ide::physical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::sas::controller($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::sas::logical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::sas::physical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::scsi::controller($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::scsi::logical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::scsi::physical_drive($self);
|
||||
|
||||
my $total_components = 0;
|
||||
my $display_by_component = '';
|
||||
my $display_by_component_append = '';
|
||||
foreach my $comp (sort(keys %{$self->{components}})) {
|
||||
# Skipping short msg when no components
|
||||
next if ($self->{components}->{$comp}->{total} == 0 && $self->{components}->{$comp}->{skip} == 0);
|
||||
$total_components += $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip};
|
||||
$display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . '/' . $self->{components}->{$comp}->{skip} . ' ' . $self->{components}->{$comp}->{name};
|
||||
$display_by_component_append = ', ';
|
||||
$self->{overload_th} = {};
|
||||
foreach my $val (@{$self->{option_results}->{threshold_overload}}) {
|
||||
if ($val !~ /^(.*?),(.*?),(.*)$/) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload option '" . $val . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my ($section, $status, $filter) = ($1, $2, $3);
|
||||
if ($self->{output}->is_litteral_status(status => $status) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong threshold-overload status '" . $val . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
$self->{overload_th}->{$section} = [] if (!defined($self->{overload_th}->{$section}));
|
||||
push @{$self->{overload_th}->{$section}}, {filter => $filter, status => $status};
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
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})
|
||||
);
|
||||
|
||||
if (defined($self->{option_results}->{no_component}) && $total_components == 0) {
|
||||
$self->{output}->output_add(severity => $self->{no_components},
|
||||
short_msg => 'No components are checked.');
|
||||
$self->{numeric_threshold} = {};
|
||||
foreach my $option (('warning', 'critical')) {
|
||||
foreach my $val (@{$self->{option_results}->{$option}}) {
|
||||
if ($val !~ /^(.*?),(.*?),(.*)$/) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my ($section, $regexp, $value) = ($1, $2, $3);
|
||||
if ($section !~ /(temperature)/) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "' (type must be: battery or temperature).");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
my $position = 0;
|
||||
if (defined($self->{numeric_threshold}->{$section})) {
|
||||
$position = scalar(@{$self->{numeric_threshold}->{$section}});
|
||||
}
|
||||
if (($self->{perfdata}->threshold_validate(label => $option . '-' . $section . '-' . $position, value => $value)) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong $option threshold '" . $value . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
$self->{numeric_threshold}->{$section} = [] if (!defined($self->{numeric_threshold}->{$section}));
|
||||
push @{$self->{numeric_threshold}->{$section}}, { label => $option . '-' . $section . '-' . $position, threshold => $option, regexp => $regexp };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub component {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
if ($self->{option_results}->{component} eq 'cpu') {
|
||||
hardware::server::hp::proliant::snmp::mode::components::cpu::check($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'psu') {
|
||||
hardware::server::hp::proliant::snmp::mode::components::psu::check($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'pc') {
|
||||
hardware::server::hp::proliant::snmp::mode::components::pc::check($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'fan') {
|
||||
hardware::server::hp::proliant::snmp::mode::components::fan::check($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'temperature') {
|
||||
hardware::server::hp::proliant::snmp::mode::components::temperature::check($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'network') {
|
||||
hardware::server::hp::proliant::snmp::mode::components::network::physical_nic($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::network::logical_nic($self);
|
||||
} elsif ($self->{option_results}->{component} eq 'storage') {
|
||||
hardware::server::hp::proliant::snmp::mode::components::ida::array_controller($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::ida::array_accelerator($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::ida::logical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::ida::physical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::fca::host_array_controller($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::fca::external_array_controller($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::fca::external_array_accelerator($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::fca::logical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::fca::physical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::ide::controller($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::ide::logical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::ide::physical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::sas::controller($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::sas::logical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::sas::physical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::scsi::controller($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::scsi::logical_drive($self);
|
||||
hardware::server::hp::proliant::snmp::mode::components::scsi::physical_drive($self);
|
||||
} else {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
if ($self->{option_results}->{component} =~ /storage/i) {
|
||||
$self->{option_results}->{component} = '^(sas|ide|fca|da|scsi).*';
|
||||
}
|
||||
|
||||
my $total_components = 0;
|
||||
my $display_by_component = '';
|
||||
my $display_by_component_append = '';
|
||||
foreach my $comp (sort(keys %{$self->{components}})) {
|
||||
# Skipping short msg when no components
|
||||
next if ($self->{components}->{$comp}->{total} == 0 && $self->{components}->{$comp}->{skip} == 0);
|
||||
$total_components += $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip};
|
||||
$display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . '/' . $self->{components}->{$comp}->{skip} . ' ' . $self->{components}->{$comp}->{name};
|
||||
$display_by_component_append = ', ';
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("All %s components [%s] are ok.",
|
||||
$total_components,
|
||||
$display_by_component)
|
||||
);
|
||||
|
||||
if (defined($self->{option_results}->{no_component}) && $total_components == 0) {
|
||||
$self->{output}->output_add(severity => $self->{no_components},
|
||||
short_msg => 'No components are checked.');
|
||||
if ($self->{option_results}->{component} =~ /network/i) {
|
||||
$self->{option_results}->{component} = '^(pnic|lnic)$';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,11 +331,62 @@ sub run {
|
|||
my ($self, %options) = @_;
|
||||
# $options{snmp} = snmp object
|
||||
$self->{snmp} = $options{snmp};
|
||||
|
||||
$self->get_system_information();
|
||||
$self->{output}->output_add(long_msg => sprintf("Product Name: %s, Serial: %s, Rom Version: %s",
|
||||
$self->{product_name}, $self->{serial}, $self->{romversion})
|
||||
);
|
||||
|
||||
if ($self->{option_results}->{component} eq 'all') {
|
||||
$self->global();
|
||||
} else {
|
||||
$self->component();
|
||||
my $snmp_request = [];
|
||||
my @components = ('cpu', 'idectl', 'ideldrive', 'idepdrive', 'pc', 'psu',
|
||||
'sasctl', 'sasldrive', 'saspdrive', 'scsictl', 'scsildrive', 'scsipdrive',
|
||||
'fcahostctl', 'fcaexternalctl', 'fcaexternalacc', 'fcaldrive', 'fcapdrive',
|
||||
'dactl', 'daacc', 'daldrive', 'dapdrive', 'fan', 'pnic', 'lnic', 'temperature');
|
||||
foreach (@components) {
|
||||
if (/$self->{option_results}->{component}/) {
|
||||
my $mod_name = "hardware::server::hp::proliant::snmp::mode::components::components::$_";
|
||||
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $mod_name,
|
||||
error_msg => "Cannot load module '$mod_name'.");
|
||||
my $func = $mod_name->can('load');
|
||||
$func->(request => $snmp_request);
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(@{$snmp_request}) == 0) {
|
||||
$self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'.");
|
||||
$self->{output}->option_exit();
|
||||
}
|
||||
$self->{results} = $self->{snmp}->get_multiple_table(oids => $snmp_request);
|
||||
|
||||
foreach (@components) {
|
||||
if (/$self->{option_results}->{component}/) {
|
||||
my $mod_name = "hardware::server::hp::proliant::snmp::mode::components::$_";
|
||||
my $func = $mod_name->can('check');
|
||||
$func->($self);
|
||||
}
|
||||
}
|
||||
|
||||
my $total_components = 0;
|
||||
my $display_by_component = '';
|
||||
my $display_by_component_append = '';
|
||||
foreach my $comp (sort(keys %{$self->{components}})) {
|
||||
# Skipping short msg when no components
|
||||
next if ($self->{components}->{$comp}->{total} == 0 && $self->{components}->{$comp}->{skip} == 0);
|
||||
$total_components += $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip};
|
||||
my $count_by_components = $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip};
|
||||
$display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . '/' . $count_by_components . ' ' . $self->{components}->{$comp}->{name};
|
||||
$display_by_component_append = ', ';
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
short_msg => sprintf("All %s components are ok [%s].",
|
||||
$total_components,
|
||||
$display_by_component)
|
||||
);
|
||||
|
||||
if (defined($self->{option_results}->{no_component}) && $total_components == 0) {
|
||||
$self->{output}->output_add(severity => $self->{no_components},
|
||||
short_msg => 'No components are checked.');
|
||||
}
|
||||
|
||||
$self->{output}->display();
|
||||
|
@ -266,6 +439,50 @@ sub absent_problem {
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
sub get_severity_numeric {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'OK'; # default
|
||||
my $thresholds = { warning => undef, critical => undef };
|
||||
my $checked = 0;
|
||||
|
||||
if (defined($self->{numeric_threshold}->{$options{section}})) {
|
||||
my $exits = [];
|
||||
foreach (@{$self->{numeric_threshold}->{$options{section}}}) {
|
||||
if ($options{instance} =~ /$_->{regexp}/) {
|
||||
push @{$exits}, $self->{perfdata}->threshold_check(value => $options{value}, threshold => [ { label => $_->{label}, exit_litteral => $_->{threshold} } ]);
|
||||
$thresholds->{$_->{threshold}} = $self->{perfdata}->get_perfdata_for_output(label => $_->{label});
|
||||
$checked = 1;
|
||||
}
|
||||
}
|
||||
$status = $self->{output}->get_most_critical(status => $exits) if (scalar(@{$exits}) > 0);
|
||||
}
|
||||
|
||||
return ($status, $thresholds->{warning}, $thresholds->{critical}, $checked);
|
||||
}
|
||||
|
||||
sub get_severity {
|
||||
my ($self, %options) = @_;
|
||||
my $status = 'UNKNOWN'; # default
|
||||
|
||||
if (defined($self->{overload_th}->{$options{section}})) {
|
||||
foreach (@{$self->{overload_th}->{$options{section}}}) {
|
||||
if ($options{value} =~ /$_->{filter}/i) {
|
||||
$status = $_->{status};
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (@{$thresholds->{$options{section}}}) {
|
||||
if ($options{value} =~ /$$_[0]/i) {
|
||||
$status = $$_[1];
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
@ -279,7 +496,8 @@ Check Hardware (CPUs, Power Supplies, Power converters, Fans).
|
|||
=item B<--component>
|
||||
|
||||
Which component to check (Default: 'all').
|
||||
Can be: 'cpu', 'psu', 'pc', 'fan', 'network', 'temperature', 'storage'.
|
||||
Can be: 'cpu', 'psu', 'pc', 'fan', 'temperature', 'lnic', 'pnic',...
|
||||
There are some magic words like: 'network', 'storage'.
|
||||
|
||||
=item B<--exclude>
|
||||
|
||||
|
@ -296,6 +514,22 @@ Can be specific or global: --absent-problem=fan#1.2#,cpu
|
|||
Return an error if no compenents are checked.
|
||||
If total (with skipped) is 0. (Default: 'critical' returns).
|
||||
|
||||
=item B<--threshold-overload>
|
||||
|
||||
Set to overload default threshold values (syntax: section,status,regexp)
|
||||
It used before default thresholds (order stays).
|
||||
Example: --threshold-overload='temperature,CRITICAL,^(?!(ok)$)'
|
||||
|
||||
=item B<--warning>
|
||||
|
||||
Set warning threshold for temperatures (syntax: type,regexp,treshold)
|
||||
Example: --warning='temperature,.*,30'
|
||||
|
||||
=item B<--critical>
|
||||
|
||||
Set critical threshold for temperatures (syntax: type,regexp,treshold)
|
||||
Example: --critical='temperature,.*,40'
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
Loading…
Reference in New Issue