add idrac snmp smart alert disk
This commit is contained in:
parent
875eaac4a1
commit
c91689476d
|
@ -22,19 +22,22 @@ package hardware::server::dell::idrac::snmp::mode::components::pdisk;
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_status %map_pdisk_state);
|
||||
use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_status %map_pdisk_state %map_pdisk_smartstate);
|
||||
|
||||
my $mapping = {
|
||||
physicalDiskState => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.4', map => \%map_pdisk_state },
|
||||
physicalDiskComponentStatus => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.24', map => \%map_status },
|
||||
physicalDiskFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.54' },
|
||||
physicalDiskState => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.4', map => \%map_pdisk_state },
|
||||
physicalDiskComponentStatus => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.24', map => \%map_status },
|
||||
physicalDiskSmartAlertIndication => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.31', map => \%map_pdisk_smartstate },
|
||||
physicalDiskFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.54' },
|
||||
};
|
||||
my $oid_physicalDiskTableEntry = '.1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1';
|
||||
|
||||
sub load {
|
||||
my ($self) = @_;
|
||||
|
||||
push @{$self->{request}}, { oid => $oid_physicalDiskTableEntry };
|
||||
foreach (keys %{$mapping}) {
|
||||
push @{$self->{request}}, { oid => $mapping->{$_}->{oid} };
|
||||
}
|
||||
}
|
||||
|
||||
sub check {
|
||||
|
@ -44,17 +47,22 @@ sub check {
|
|||
$self->{components}->{pdisk} = {name => 'physical disks', total => 0, skip => 0};
|
||||
return if ($self->check_filter(section => 'pdisk'));
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_physicalDiskTableEntry}})) {
|
||||
next if ($oid !~ /^$mapping->{physicalDiskComponentStatus}->{oid}\.(.*)$/);
|
||||
my $results = {};
|
||||
foreach (keys %{$mapping}) {
|
||||
$results = { %$results, %{$self->{results}->{$mapping->{$_}->{oid}}} }
|
||||
}
|
||||
|
||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{physicalDiskComponentStatus}->{oid}}})) {
|
||||
$oid =~ /^$mapping->{physicalDiskComponentStatus}->{oid}\.(.*)$/;
|
||||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_physicalDiskTableEntry}, instance => $instance);
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $results, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'pdisk', instance => $instance));
|
||||
$self->{components}->{pdisk}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("physical disk '%s' status is '%s' [instance = %s] [state = %s]",
|
||||
$self->{output}->output_add(long_msg => sprintf("physical disk '%s' status is '%s' [instance = %s] [state = %s] [smart alert = %s]",
|
||||
$result->{physicalDiskFQDD}, $result->{physicalDiskComponentStatus}, $instance,
|
||||
$result->{physicalDiskState}));
|
||||
$result->{physicalDiskState}, $result->{physicalDiskSmartAlertIndication}));
|
||||
|
||||
my $exit = $self->get_severity(section => 'pdisk.state', value => $result->{physicalDiskState});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
|
@ -68,6 +76,12 @@ sub check {
|
|||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("physical disk '%s' status is '%s'", $result->{physicalDiskFQDD}, $result->{physicalDiskComponentStatus}));
|
||||
}
|
||||
|
||||
$exit = $self->get_severity(section => 'pdisk.smartalert', value => $result->{physicalDiskSmartAlertIndication});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("physical disk '%s' smart alert predictive failure is '%s'", $result->{physicalDiskFQDD}, $result->{physicalDiskSmartAlertIndication}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,10 +29,16 @@ our %map_status;
|
|||
our %map_probe_status;
|
||||
our %map_amperage_type;
|
||||
our %map_pdisk_state;
|
||||
our %map_pdisk_smartstate;
|
||||
our %map_vdisk_state;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT_OK = qw(%map_probe_status %map_state %map_status %map_amperage_type %map_pdisk_state %map_vdisk_state);
|
||||
our @EXPORT_OK = qw(%map_probe_status %map_state %map_status %map_amperage_type %map_pdisk_state %map_pdisk_smartstate %map_vdisk_state);
|
||||
|
||||
%map_pdisk_smartstate = (
|
||||
0 => 'off',
|
||||
1 => 'on',
|
||||
);
|
||||
|
||||
%map_probe_status = (
|
||||
1 => 'other',
|
||||
|
@ -105,4 +111,4 @@ our @EXPORT_OK = qw(%map_probe_status %map_state %map_status %map_amperage_type
|
|||
26 => 'amperageProbeTypeIsSystemWatts',
|
||||
);
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -69,6 +69,10 @@ sub set_system {
|
|||
['non-raid', 'OK'],
|
||||
['removed', 'OK'],
|
||||
],
|
||||
'pdisk.smartalert' => [
|
||||
['off', 'OK'],
|
||||
['on', 'WARNING'],
|
||||
],
|
||||
'vdisk.state' => [
|
||||
['unknown', 'UNKNOWN'],
|
||||
['online', 'OK'],
|
||||
|
|
Loading…
Reference in New Issue