(plugin) hardware::server::hp::proliant::snmp - memory component error (#3575)

This commit is contained in:
qgarnier 2022-04-01 08:37:30 +02:00 committed by GitHub
parent 04aff7a8aa
commit ba119ccb3b
2 changed files with 18 additions and 8 deletions

View File

@ -68,8 +68,8 @@ sub check {
$self->{components}->{ilo} = {name => 'ilo', total => 0, skip => 0};
return if ($self->check_filter(section => 'ilo'));
return if (scalar(keys %{$self->{results}->{$mapping->{cpqSm2MibCondition}->{oid}}}) == 0);
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{cpqSm2MibCondition}->{oid}}, instance => '0');
return if (scalar(keys %{$self->{results}->{$mapping->{cpqSm2MibCondition}->{oid}}}) <= 0);
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{cpqSm2MibCondition}->{oid}}, instance => 0);
next if ($self->check_filter(section => 'ilo', instance => '0'));
$self->{components}->{ilo}->{total}++;
@ -83,14 +83,22 @@ sub check {
}
}
$self->{output}->output_add(long_msg => sprintf("ilo status is %s [message = %s].",
$result->{cpqSm2MibCondition}, join(', ', @message_error)));
$self->{output}->output_add(
long_msg => sprintf(
"ilo status is %s [message = %s].",
$result->{cpqSm2MibCondition}, join(', ', @message_error)
)
);
my $exit = $self->get_severity(label => 'default', section => 'ilo', value => $result->{cpqSm2MibCondition});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("ilo is %s",
$result->{cpqSm2MibCondition}));
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf(
"ilo is %s",
$result->{cpqSm2MibCondition}
)
);
}
}
1;
1;

View File

@ -61,6 +61,8 @@ sub check {
$self->{components}->{memory} = { name => 'memory', total => 0, skip => 0 };
return if ($self->check_filter(section => 'memory'));
return if (scalar(keys %{$self->{results}->{$oid_cpqHeResMem2Module}}) <= 0);
$self->{snmp}->load(
oids => [map($_->{oid}, values(%$mapping))],
instances => [values(%{$self->{results}->{$oid_cpqHeResMem2Module}})]