mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-29 08:34:46 +02:00
fix(hp/proliant/snmp): hardware mode - memory component issue (#3122)
This commit is contained in:
parent
641dd69fee
commit
cb89038ba6
@ -41,43 +41,56 @@ my %map_memory_status = (
|
|||||||
15 => 'trainingFailure'
|
15 => 'trainingFailure'
|
||||||
);
|
);
|
||||||
|
|
||||||
# In MIB 'CPQHLTH-MIB.mib'
|
|
||||||
my $mapping = {
|
my $mapping = {
|
||||||
cpqHeResMem2Module => { oid => '.1.3.6.1.4.1.232.6.2.14.13.1.1' },
|
size => { oid => '.1.3.6.1.4.1.232.6.2.14.13.1.6' }, # cpqHeResMem2ModuleSize
|
||||||
cpqHeResMem2ModuleSize => { oid => '.1.3.6.1.4.1.232.6.2.14.13.1.6' },
|
location => { oid => '.1.3.6.1.4.1.232.6.2.14.13.1.13' }, # cpqHeResMem2ModuleHwLocation
|
||||||
cpqHeResMem2ModuleHwLocation => { oid => '.1.3.6.1.4.1.232.6.2.14.13.1.13' },
|
status => { oid => '.1.3.6.1.4.1.232.6.2.14.13.1.19', map => \%map_memory_status } # cpqHeResMem2ModuleStatus
|
||||||
cpqHeResMem2ModuleStatus => { oid => '.1.3.6.1.4.1.232.6.2.14.13.1.19', map => \%map_memory_status }
|
|
||||||
};
|
};
|
||||||
my $oid_cpqHeResMem2ModuleEntry = '.1.3.6.1.4.1.232.6.2.14.13.1';
|
my $oid_cpqHeResMem2Module = '.1.3.6.1.4.1.232.6.2.14.13.1.1';
|
||||||
|
|
||||||
sub load {
|
sub load {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
push @{$self->{request}}, { oid => $oid_cpqHeResMem2ModuleEntry, start => $mapping->{cpqHeResMem2Module}->{oid}, end => $mapping->{cpqHeResMem2ModuleStatus}->{oid} };
|
|
||||||
|
push @{$self->{request}}, { oid => $oid_cpqHeResMem2Module };
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check {
|
sub check {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => "Checking memory");
|
$self->{output}->output_add(long_msg => "Checking memory");
|
||||||
$self->{components}->{memory} = {name => 'mems', total => 0, skip => 0};
|
$self->{components}->{memory} = { name => 'memory', total => 0, skip => 0 };
|
||||||
return if ($self->check_filter(section => 'memory'));
|
return if ($self->check_filter(section => 'memory'));
|
||||||
|
|
||||||
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_cpqHeResMem2ModuleEntry}})) {
|
$self->{snmp}->load(
|
||||||
next if ($oid !~ /^$mapping->{cpqHeResMem2ModuleStatus}->{oid}\.(.*)$/);
|
oids => [map($_->{oid}, values(%$mapping))],
|
||||||
my $instance = $1;
|
instances => [values(%{$self->{results}->{$oid_cpqHeResMem2Module}})]
|
||||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cpqHeResMem2ModuleEntry}, instance => $instance);
|
);
|
||||||
|
my $results = $self->{snmp}->get_leef();
|
||||||
|
|
||||||
|
foreach my $instance (sort values(%{$self->{results}->{$oid_cpqHeResMem2Module}})) {
|
||||||
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $results, instance => $instance);
|
||||||
|
|
||||||
next if ($self->check_filter(section => 'memory', instance => $instance));
|
next if ($self->check_filter(section => 'memory', instance => $instance));
|
||||||
$self->{components}->{memory}->{total}++;
|
$self->{components}->{memory}->{total}++;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("memory '%s' [slot: %s, location: %s, size: %skB] status is %s.",
|
$self->{output}->output_add(
|
||||||
$instance, $result->{cpqHeResMem2Module}, $result->{cpqHeResMem2ModuleHwLocation},
|
long_msg => sprintf(
|
||||||
$result->{cpqHeResMem2ModuleSize}, $result->{cpqHeResMem2ModuleStatus}));
|
"memory slot '%s' [location: %s, size: %skB] status is %s",
|
||||||
my $exit = $self->get_severity(section => 'memory', value => $result->{cpqHeResMem2ModuleStatus});
|
$instance,
|
||||||
|
defined($result->{location}) ? $result->{location} : '-',
|
||||||
|
$result->{size},
|
||||||
|
$result->{status}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
my $exit = $self->get_severity(section => 'memory', value => $result->{status});
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("memory '%s' is %s",
|
severity => $exit,
|
||||||
$instance, $result->{cpqHeResMem2ModuleStatus}));
|
short_msg => sprintf(
|
||||||
|
"memory slot '%s' is %s",
|
||||||
|
$instance, $result->{status}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user