fix huawei ibmc raidcontroller bug #1244
This commit is contained in:
parent
51c16b4419
commit
bd00d22cdf
|
@ -63,7 +63,7 @@ sub check {
|
|||
$result->{logicalDriveRAIDControllerIndex}, $result->{logicalDriveIndex}, $result->{logicalDriveState}, $instance,
|
||||
));
|
||||
|
||||
my $exit = $self->get_severity(label => 'logicaldrive', section => 'logicaldrive', value => $result->{logicalDriveState});
|
||||
my $exit = $self->get_severity(section => 'logicaldrive', value => $result->{logicalDriveState});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Logical drive '%s.%s' status is '%s'",
|
||||
|
@ -74,4 +74,4 @@ sub check {
|
|||
}
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -23,18 +23,9 @@ package hardware::server::huawei::ibmc::snmp::mode::components::raidcontroller;
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %map_status = (
|
||||
1 => 'ok',
|
||||
2 => 'minor',
|
||||
3 => 'major',
|
||||
4 => 'critical',
|
||||
5 => 'absence',
|
||||
6 => 'unknown',
|
||||
);
|
||||
|
||||
my $mapping = {
|
||||
raidControllerStatus => { oid => '.1.3.6.1.4.1.2011.2.235.1.1.36.50.1.7', map => \%map_status },
|
||||
raidControllerComponentName => { oid => '.1.3.6.1.4.1.2011.2.235.1.1.36.50.1.4' },
|
||||
raidControllerHealthStatus => { oid => '.1.3.6.1.4.1.2011.2.235.1.1.36.50.1.7' },
|
||||
raidControllerComponentName => { oid => '.1.3.6.1.4.1.2011.2.235.1.1.36.50.1.4' },
|
||||
};
|
||||
my $oid_raidControllerDescriptionEntry = '.1.3.6.1.4.1.2011.2.235.1.1.36.50.1';
|
||||
|
||||
|
@ -51,25 +42,54 @@ sub check {
|
|||
$self->{components}->{raidcontroller} = {name => 'raidcontrollers', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'raidcontroller'));
|
||||
|
||||
my %bitmap_status = (
|
||||
0 => 'memory correctable error',
|
||||
1 => 'memory uncorrectable error',
|
||||
2 => 'memory ECC error reached limit',
|
||||
3 => 'NVRAM uncorrectable error',
|
||||
);
|
||||
my %map_status = (
|
||||
0 => 'ok',
|
||||
65535 => 'unknown',
|
||||
);
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_raidControllerDescriptionEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{raidControllerStatus}->{oid}\.(.*)$/);
|
||||
next if ($oid !~ /^$mapping->{raidControllerHealthStatus}->{oid}\.(.*)$/);
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_raidControllerDescriptionEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'raidcontroller', instance => $instance));
|
||||
next if ($result->{raidControllerStatus} =~ /absence/);
|
||||
$self->{components}->{raidcontroller}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("Raid controller '%s' status is '%s' [instance = %s]",
|
||||
$result->{raidControllerComponentName}, $result->{raidControllerStatus}, $instance,
|
||||
));
|
||||
|
||||
if (defined($map_status{$result->{raidControllerHealthStatus}})) {
|
||||
$self->{output}->output_add(long_msg => sprintf("Raid controller '%s' status is '%s' [instance = %s]",
|
||||
$result->{raidControllerComponentName}, $map_status{$result->{raidControllerHealthStatus}}, $instance,
|
||||
));
|
||||
|
||||
my $exit = $self->get_severity(label => 'default', section => 'Raid controller', value => $result->{raidControllerStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Raid controller '%s' status is '%s'", $result->{raidControllerComponentName}, $result->{raidControllerStatus}));
|
||||
my $exit = $self->get_severity(section => 'raidcontroller', value => $map_status{$result->{raidControllerHealthStatus}});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Raid controller '%s' status is '%s'", $result->{raidControllerComponentName}, $map_status{$result->{raidControllerHealthStatus}}));
|
||||
}
|
||||
|
||||
next;
|
||||
}
|
||||
|
||||
for (my $i = 0; $i < 4; $i++) {
|
||||
next if (!($result->{raidControllerHealthStatus} & (1 << $i)));
|
||||
|
||||
my $status = $bitmap_status{$i};
|
||||
$self->{output}->output_add(long_msg => sprintf("Raid controller '%s' status is '%s' [instance = %s]",
|
||||
$result->{raidControllerComponentName}, $status, $instance,
|
||||
));
|
||||
|
||||
my $exit = $self->get_severity(section => 'raidcontroller', value => $status);
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Raid controller '%s' status is '%s'", $result->{raidControllerComponentName}, $status));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -49,6 +49,14 @@ sub set_system {
|
|||
['optimal', 'OK'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
],
|
||||
'raidcontroller' => [
|
||||
['memory correctable error', 'WARNING'],
|
||||
['memory uncorrectable error', 'CRITICAL'],
|
||||
['memory ECC error reached limit', 'CRITICAL'],
|
||||
['NVRAM uncorrectable error', 'CRITICAL'],
|
||||
['ok', 'OK'],
|
||||
['unknown', 'UNKNOWN'],
|
||||
],
|
||||
};
|
||||
|
||||
$self->{components_path} = 'hardware::server::huawei::ibmc::snmp::mode::components';
|
||||
|
|
Loading…
Reference in New Issue