diff --git a/centreon-plugins/hardware/server/hp/ilo/xmlapi/custom/api.pm b/centreon-plugins/hardware/server/hp/ilo/xmlapi/custom/api.pm index 88a5f611f..2b6dc98d6 100644 --- a/centreon-plugins/hardware/server/hp/ilo/xmlapi/custom/api.pm +++ b/centreon-plugins/hardware/server/hp/ilo/xmlapi/custom/api.pm @@ -229,6 +229,28 @@ sub change_shitty_xml { $options{response} =~ s///mg; + #Other shitty xml: + # + #  + # + #  + #  + #  + # + #  + #  + #  + # + #  + #  + #  + # + #  + #  + #  + # + $options{response} =~ s///msg; + return $options{response}; } @@ -250,7 +272,7 @@ sub get_ilo_response { $xml_result = XMLin($response, ForceArray => ['FAN', 'TEMP', 'MODULE', 'SUPPLY', 'PROCESSOR', 'NIC', 'SMART_STORAGE_BATTERY', 'CONTROLLER', 'DRIVE_ENCLOSURE', - 'LOGICAL_DRIVE', 'PHYSICAL_DRIVE', 'DRIVE_BAY']); + 'LOGICAL_DRIVE', 'PHYSICAL_DRIVE', 'DRIVE_BAY', 'BACKPLANE']); }; if ($@) { $self->{output}->add_option_msg(short_msg => "Cannot decode xml response: $@"); @@ -264,6 +286,7 @@ sub get_ilo_data { my ($self, %options) = @_; $self->{content} = ''; + if (!defined($self->{option_results}->{force_ilo3})) { $self->find_ilo_version(); } else { diff --git a/centreon-plugins/hardware/server/hp/ilo/xmlapi/mode/components/pdrive.pm b/centreon-plugins/hardware/server/hp/ilo/xmlapi/mode/components/pdrive.pm index 8b9e57492..25da27bf0 100644 --- a/centreon-plugins/hardware/server/hp/ilo/xmlapi/mode/components/pdrive.pm +++ b/centreon-plugins/hardware/server/hp/ilo/xmlapi/mode/components/pdrive.pm @@ -76,7 +76,7 @@ sub check_ilo4 { sub check_ilo2 { my ($self) = @_; - return if (!defined($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{DRIVES}->{DRIVE_BAY})); + return if (!defined($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{DRIVES}->{DRIVE_BAY})); # In ILO2: # # @@ -103,6 +103,52 @@ sub check_ilo2 { } } +sub check_ilo3 { + my ($self) = @_; + + return if (!defined($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{DRIVES}->{BACKPLANE})); + # In ILO3: + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + # + foreach my $backplane (@{$self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{DRIVES}->{BACKPLANE}}) { + next if (!defined($backplane->{DRIVE_BAY})); + + foreach my $result (@{$backplane->{DRIVE_BAY}}) { + my $instance = $result->{NUM}; + + next if ($self->check_filter(section => 'pdrive', instance => $instance)); + next if ($result->{STATUS} =~ /not installed|n\/a|not present|not applicable/i && + $self->absent_problem(section => 'pdrive', instance => $instance)); + + $self->{components}->{pdrive}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("physical drive '%s' status is '%s' [instance = %s]", + $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)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Physical drive '%s' status is '%s'", $result->{NUM}, $result->{STATUS})); + } + } + } +} + sub check { my ($self) = @_; @@ -111,7 +157,8 @@ sub check { return if ($self->check_filter(section => 'pdrive')); check_ilo4($self); + check_ilo3($self); check_ilo2($self); } -1; \ No newline at end of file +1;