fix hp ilo xmlapi pdrive xml variant (#1105)

This commit is contained in:
Colin Gagnaire 2018-08-22 08:24:12 +00:00 committed by Simon Bomm
parent 1961b40811
commit fe2911fbe3
2 changed files with 26 additions and 1 deletions

View File

@ -251,6 +251,30 @@ sub change_shitty_xml {
# </BACKPLANE>
$options{response} =~ s/<DRIVE_BAY\s+VALUE\s*=\s*"(.*?)".*?<STATUS\s+VALUE\s*=\s*"(.*?)".*?<UID_LED\s+VALUE\s*=\s*"(.*?)".*?\/>/<DRIVE_BAY NUM="$1" STATUS="$2" UID_LED="$3" \/>/msg;
# 3rd variant, known as the ArnoMLT variant
# <BACKPLANE>
# <FIRMWARE VERSION="1.16"/>
# <ENCLOSURE ADDR="224"/>
# <DRIVE BAY="1"/>
# <PRODUCT ID="EG0300FCVBF"/>
# <DRIVE_STATUS VALUE="Ok"/>
# <UID LED="Off"/>
# <DRIVE BAY="2"/>
# <PRODUCT ID="EH0146FARUB"/>
# <DRIVE_STATUS VALUE="Ok"/>
# <UID LED="Off"/>
# <DRIVE BAY="3"/>
# <PRODUCT ID="EH0146FBQDC"/>
# <DRIVE_STATUS VALUE="Ok"/>
# <UID LED="Off"/>
# <DRIVE BAY="4"/>
# <PRODUCT ID="N/A"/>
# <DRIVE_STATUS VALUE="Not Installed"/>
# <UID LED="Off"/>
# </BACKPLANE>
$options{response} =~ s/<FIRMWARE\s+VERSION\s*=\s*"(.*?)".*?<ENCLOSURE\s+ADDR\s*=\s*"(.*?)".*?\/>/<BACKPLANE FIRMWARE_VERSION="$1" ENCLOSURE_ADDR="$2"/mg;
$options{response} =~ s/<DRIVE\s+BAY\s*=\s*"(.*?)".*?<DRIVE_STATUS\s+VALUE\s*=\s*"(.*?)".*?<UID\s+LED\s*=\s*"(.*?)".*?\/>/<DRIVE_BAY NUM="$1" STATUS="$2" UID_LED="$3" \/>/msg;
return $options{response};
}

View File

@ -22,6 +22,7 @@ package hardware::server::hp::ilo::xmlapi::mode::components::pdrive;
use strict;
use warnings;
use centreon::plugins::misc;
sub load { }
@ -93,7 +94,7 @@ sub check_ilo2 {
$self->{components}->{pdrive}->{total}++;
$self->{output}->output_add(long_msg => sprintf("physical drive '%s' status is '%s' [instance = %s]",
$result->{NUM}, $result->{STATUS}, $instance));
centreon::plugins::misc::trim($result->{NUM}), $result->{STATUS}, $instance));
my $exit = $self->get_severity(label => 'default', section => 'pdrive', value => $result->{STATUS});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {