fix hp-p2000-xmlapi - undefined values for sensor and enclosure

This commit is contained in:
Stephane Duret 2019-08-07 09:55:31 +02:00
parent 5ed8b0c9fb
commit 9cf6b3000b
2 changed files with 2 additions and 2 deletions

View File

@ -52,7 +52,7 @@ sub check {
my $state = $health{$results->{$enc_id}->{'health-numeric'}};
$self->{output}->output_add(long_msg => sprintf("enclosure '%s' status is %s [instance: %s] [reason: %s]",
$enc_id, $state, $enc_id, $health{$results->{$enc_id}->{'health-reason'}})
$enc_id, $state, $enc_id, $results->{$enc_id}->{'health-reason'})
);
my $exit = $self->get_severity(label => 'default', section => 'enclosure', value => $state);
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {

View File

@ -62,7 +62,7 @@ sub check {
# <PROPERTY name="status" type="string" size="8" draw="true" sort="string" display-name="Status">Warning</PROPERTY>
#</OBJECT>
foreach my $sensor_id (keys %$results) {
my ($value, $unit);
my ($value, $unit) = ('', '');;
($value, $unit) = ($1, $2) if ($results->{$sensor_id}->{value} =~ /\s*([0-9\.,]+)\s*(\S*)\s*/);
if (defined($results->{$sensor_id}->{'sensor-type'}) && defined($sensor_type{$results->{$sensor_id}->{'sensor-type'}})) {
$unit = $sensor_type{$results->{$sensor_id}->{'sensor-type'}}->{unit};