diff --git a/hardware/server/hp/ilo/xmlapi/custom/api.pm b/hardware/server/hp/ilo/xmlapi/custom/api.pm
new file mode 100644
index 000000000..b7b4a1d30
--- /dev/null
+++ b/hardware/server/hp/ilo/xmlapi/custom/api.pm
@@ -0,0 +1,337 @@
+#
+# Copyright 2016 Centreon (http://www.centreon.com/)
+#
+# Centreon is a full-fledged industry-strength solution that meets
+# the needs in IT infrastructure and application monitoring for
+# service performance.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package hardware::server::hp::ilo::xmlapi::custom::api;
+
+use strict;
+use warnings;
+use IO::Socket::SSL;
+use LWP::UserAgent;
+use XML::Simple;
+
+sub new {
+ my ($class, %options) = @_;
+ my $self = {};
+ bless $self, $class;
+
+ if (!defined($options{output})) {
+ print "Class Custom: Need to specify 'output' argument.\n";
+ exit 3;
+ }
+ if (!defined($options{options})) {
+ $options{output}->add_option_msg(short_msg => "Class Custom: Need to specify 'options' argument.");
+ $options{output}->option_exit();
+ }
+
+ if (!defined($options{noptions})) {
+ $options{options}->add_options(arguments =>
+ {
+ "hostname:s" => { name => 'hostname' },
+ "timeout:s" => { name => 'timeout', default => 30 },
+ "port:s" => { name => 'port', default => 443 },
+ "username:s" => { name => 'username' },
+ "password:s" => { name => 'password' },
+ 'ssl-opt:s%' => { name => 'ssl_opt' },
+ "force-ilo3" => { name => 'force_ilo3' },
+ });
+ }
+ $options{options}->add_help(package => __PACKAGE__, sections => 'XML API OPTIONS', once => 1);
+
+ $self->{output} = $options{output};
+ $self->{mode} = $options{mode};
+
+ return $self;
+}
+
+sub set_options {
+ my ($self, %options) = @_;
+
+ $self->{option_results} = $options{option_results};
+}
+
+sub set_defaults {
+ my ($self, %options) = @_;
+
+ foreach (keys %{$options{default}}) {
+ if ($_ eq $self->{mode}) {
+ for (my $i = 0; $i < scalar(@{$options{default}->{$_}}); $i++) {
+ foreach my $opt (keys %{$options{default}->{$_}[$i]}) {
+ if (!defined($self->{option_results}->{$opt}[$i])) {
+ $self->{option_results}->{$opt}[$i] = $options{default}->{$_}[$i]->{$opt};
+ }
+ }
+ }
+ }
+ }
+}
+
+sub check_options {
+ my ($self, %options) = @_;
+
+ if (!defined($self->{option_results}->{hostname}) || $self->{option_results}->{hostname} eq '') {
+ $self->{output}->add_option_msg(short_msg => "Need to set hostname option.");
+ $self->{output}->option_exit();
+ }
+ if (!defined($self->{option_results}->{username}) || $self->{option_results}->{username} eq '') {
+ $self->{output}->add_option_msg(short_msg => "Need to set username option.");
+ $self->{output}->option_exit();
+ }
+ if (!defined($self->{option_results}->{password})) {
+ $self->{output}->add_option_msg(short_msg => "Need to set password option.");
+ $self->{output}->option_exit();
+ }
+
+ $self->{ssl_opts} = '';
+ if (!defined($self->{option_results}->{ssl_opt})) {
+ $self->{ssl_opts} = 'SSL_verify_mode => SSL_VERIFY_NONE';
+ } else {
+ foreach (keys %{$self->{option_results}->{ssl_opt}}) {
+ $self->{ssl_opts} .= "$_ => " . $self->{option_results}->{ssl_opt}->{$_} . ", ";
+ }
+ }
+
+ return 0;
+}
+
+sub find_ilo_version {
+ my ($self, %options) = @_;
+
+ ($self->{ilo2}, $self->{ilo3}) = (0, 0);
+ my $client = new IO::Socket::SSL->new(PeerAddr => $self->{option_results}->{hostname} . ':' . $self->{option_results}->{port},
+ eval $self->{ssl_opts}, Timeout => $self->{option_results}->{timeout});
+ if (!$client) {
+ $self->{output}->add_option_msg(short_msg => "Failed to establish SSL connection: $!, ssl_error=$SSL_ERROR");
+ $self->{output}->option_exit();
+ }
+
+ print $client 'POST /ribcl HTTP/1.1' . "\r\n";
+ print $client "HOST: me" . "\r\n"; # Mandatory for http 1.1
+ print $client "User-Agent: locfg-Perl-script/3.0\r\n";
+ print $client "Content-length: 30" . "\r\n"; # Mandatory for http 1.1
+ print $client 'Connection: Close' . "\r\n"; # Required
+ print $client "\r\n"; # End of http header
+ print $client "\r\n"; # Used by Content-length
+ my $ln = <$client>;
+ if ($ln =~ m/HTTP.1.1 200 OK/) {
+ $self->{ilo3} = 1;
+ } else {
+ $self->{ilo2} = 1;
+ }
+ close $client;
+}
+
+sub get_ilo2_data {
+ my ($self, %options) = @_;
+
+ my $client = new IO::Socket::SSL->new(PeerAddr => $self->{option_results}->{hostname} . ':' . $self->{option_results}->{port},
+ eval $self->{ssl_opts}, Timeout => $self->{option_results}->{timeout});
+ if (!$client) {
+ $self->{output}->add_option_msg(short_msg => "Failed to establish SSL connection: $!, ssl_error=$SSL_ERROR");
+ $self->{output}->option_exit();
+ }
+ print $client '' . "\r\n";
+ print $client '' . "\r\n";
+ print $client '' . "\r\n";
+ print $client '' . "\r\n";
+ print $client '' . "\r\n";
+ print $client '' . "\r\n";
+ print $client '' . "\r\n";
+ print $client '' . "\r\n";
+
+ while (my $line = <$client>) {
+ $self->{content} .= $line;
+ }
+ close $client;
+}
+
+sub get_ilo3_data {
+ my ($self, %options) = @_;
+
+ my $xml_script = "
+ {option_results}->{username}\" PASSWORD=\"$self->{option_results}->{password}\">
+
+
+
+
+
+";
+
+ my $ua = LWP::UserAgent->new(keep_alive => 0, protocols_allowed => ['http', 'https'], timeout => $self->{option_results}->{timeout});
+ my $req = HTTP::Request->new(POST => "https://" . $self->{option_results}->{hostname} . '/ribcl');
+ $req->content_length(length($xml_script));
+ $req->content($xml_script);
+ $req->header(TE => 'chunked');
+ $req->header(Connection => 'Close');
+
+ my $context = new IO::Socket::SSL::SSL_Context(eval $self->{ssl_opts});
+ IO::Socket::SSL::set_default_context($context);
+
+ my $response = $ua->request($req);
+ $self->{content} = $response->content;
+ if (!$response->is_success) {
+ $self->{output}->add_option_msg(short_msg => "Cannot get data: $response->status_line");
+ $self->{output}->option_exit();
+ }
+}
+
+sub check_ilo_error {
+ my ($self, %options) = @_;
+
+ # Looking for:
+ #
+ while ($self->{content} =~ /]*?status="0x(.*?)"[^>]*?message='(.*?)'/msig) {
+ my ($status_code, $message) = ($1, $2);
+ if ($status_code !~ /^0+$/) {
+ $self->{output}->add_option_msg(short_msg => "Cannot get data: $2");
+ $self->{output}->option_exit();
+ }
+ }
+}
+
+sub change_shitty_xml {
+ my ($self, %options) = @_;
+
+ # Can be like that the root ???!!
+ $options{response} =~ s///mg;
+ # ILO2 can send:
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ $options{response} =~ s///mg;
+
+ return $options{response};
+}
+
+sub get_ilo_response {
+ my ($self, %options) = @_;
+
+ # ilo result is so shitty. We get the good result from size...
+ my ($length, $response) = (0, '');
+ foreach (split /<\?xml.*?\?>/, $self->{content}) {
+ if (length($_) > $length) {
+ $response = $_;
+ $length = length($_);
+ }
+ }
+
+ $response = $self->change_shitty_xml(response => $response);
+ my $xml_result;
+ eval {
+ $xml_result = XMLin($response,
+ ForceArray => ['FAN', 'TEMP', 'MODULE', 'SUPPLY', 'PROCESSOR', 'NIC',
+ 'SMART_STORAGE_BATTERY', 'CONTROLLER', 'DRIVE_ENCLOSURE',
+ 'LOGICAL_DRIVE', 'PHYSICAL_DRIVE', 'DRIVE_BAY']);
+ };
+ if ($@) {
+ $self->{output}->add_option_msg(short_msg => "Cannot decode xml response: $@");
+ $self->{output}->option_exit();
+ }
+
+ return $xml_result;
+}
+
+sub get_ilo_data {
+ my ($self, %options) = @_;
+
+ $self->{content} = '';
+ if (!defined($self->{option_results}->{force_ilo3})) {
+ $self->find_ilo_version();
+ } else {
+ $self->{ilo3} = 1;
+ }
+
+ if ($self->{ilo3} == 1) {
+ $self->get_ilo3_data();
+ } else {
+ $self->get_ilo2_data();
+ }
+
+ $self->{content} =~ s/\r//sg;
+ $self->{output}->output_add(long_msg => $self->{content}, debug => 1);
+
+ $self->check_ilo_error();
+ return $self->get_ilo_response();
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+ILO API
+
+=head1 SYNOPSIS
+
+ilo api
+
+=head1 XML API OPTIONS
+
+=over 8
+
+=item B<--hostname>
+
+Hostname to query.
+
+=item B<--username>
+
+ILO username.
+
+=item B<--password>
+
+ILO password.
+
+=item B<--port>
+
+ILO Port (Default: 443).
+
+=item B<--timeout>
+
+Set timeout (Default: 30).
+
+=item B<--force-ilo3>
+
+Don't try to find ILO version.
+
+=item B<--ssl-opt>
+
+Set SSL Options (--ssl-opt="SSL_version=SSLv3").
+Default: --ssl-opt="SSL_version=SSL_VERIFY_NONE"
+
+=back
+
+=head1 DESCRIPTION
+
+B.
+
+=cut
diff --git a/hardware/server/hp/ilo/xmlapi/mode/components/battery.pm b/hardware/server/hp/ilo/xmlapi/mode/components/battery.pm
new file mode 100644
index 000000000..9f413f63f
--- /dev/null
+++ b/hardware/server/hp/ilo/xmlapi/mode/components/battery.pm
@@ -0,0 +1,68 @@
+#
+# Copyright 2016 Centreon (http://www.centreon.com/)
+#
+# Centreon is a full-fledged industry-strength solution that meets
+# the needs in IT infrastructure and application monitoring for
+# service performance.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package hardware::server::hp::ilo::xmlapi::mode::components::battery;
+
+use strict;
+use warnings;
+
+sub load { }
+
+sub check {
+ my ($self) = @_;
+
+ $self->{output}->output_add(long_msg => "Checking batteries");
+ $self->{components}->{battery} = {name => 'battery', total => 0, skip => 0};
+ return if ($self->check_filter(section => 'battery'));
+ return if (!defined($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{POWER_SUPPLIES}->{SMART_STORAGE_BATTERY}));
+
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+
+ foreach my $result (@{$self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{POWER_SUPPLIES}->{SMART_STORAGE_BATTERY}}) {
+ my $instance = $result->{LABEL}->{VALUE};
+
+ next if ($self->check_filter(section => 'battery', instance => $instance));
+ next if ($result->{STATUS}->{VALUE} =~ /not installed|n\/a|not present|not applicable/i &&
+ $self->absent_problem(section => 'battery', instance => $instance));
+
+ $self->{components}->{battery}->{total}++;
+
+ $self->{output}->output_add(long_msg => sprintf("battery '%s' status is '%s' [instance = %s]",
+ $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}, $instance));
+
+ my $exit = $self->get_severity(label => 'default', section => 'battery', value => $result->{STATUS}->{VALUE});
+ if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
+ $self->{output}->output_add(severity => $exit,
+ short_msg => sprintf("Battery '%s' status is '%s'", $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}));
+ }
+ }
+}
+
+1;
\ No newline at end of file
diff --git a/hardware/server/hp/ilo/xmlapi/mode/components/cpu.pm b/hardware/server/hp/ilo/xmlapi/mode/components/cpu.pm
new file mode 100644
index 000000000..56d81ddf5
--- /dev/null
+++ b/hardware/server/hp/ilo/xmlapi/mode/components/cpu.pm
@@ -0,0 +1,68 @@
+#
+# Copyright 2016 Centreon (http://www.centreon.com/)
+#
+# Centreon is a full-fledged industry-strength solution that meets
+# the needs in IT infrastructure and application monitoring for
+# service performance.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package hardware::server::hp::ilo::xmlapi::mode::components::cpu;
+
+use strict;
+use warnings;
+
+sub load { }
+
+sub check {
+ my ($self) = @_;
+
+ $self->{output}->output_add(long_msg => "Checking cpu");
+ $self->{components}->{cpu} = {name => 'cpu', total => 0, skip => 0};
+ return if ($self->check_filter(section => 'cpu'));
+ return if (!defined($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{PROCESSORS}->{PROCESSOR}));
+
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ foreach my $result (@{$self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{PROCESSORS}->{PROCESSOR}}) {
+ my $instance = $result->{LABEL}->{VALUE};
+
+ next if ($self->check_filter(section => 'cpu', instance => $instance));
+ next if ($result->{STATUS}->{VALUE} =~ /not installed|n\/a|not present|not applicable/i &&
+ $self->absent_problem(section => 'cpu', instance => $instance));
+
+ $self->{components}->{cpu}->{total}++;
+
+ $self->{output}->output_add(long_msg => sprintf("cpu '%s' status is '%s' [instance = %s]",
+ $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}, $instance));
+
+ my $exit = $self->get_severity(label => 'default', section => 'CPU', value => $result->{STATUS}->{VALUE});
+ if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
+ $self->{output}->output_add(severity => $exit,
+ short_msg => sprintf("CPU '%s' status is '%s'", $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}));
+ }
+ }
+}
+
+1;
\ No newline at end of file
diff --git a/hardware/server/hp/ilo/xmlapi/mode/components/ctrl.pm b/hardware/server/hp/ilo/xmlapi/mode/components/ctrl.pm
new file mode 100644
index 000000000..70cb4e342
--- /dev/null
+++ b/hardware/server/hp/ilo/xmlapi/mode/components/ctrl.pm
@@ -0,0 +1,68 @@
+#
+# Copyright 2016 Centreon (http://www.centreon.com/)
+#
+# Centreon is a full-fledged industry-strength solution that meets
+# the needs in IT infrastructure and application monitoring for
+# service performance.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package hardware::server::hp::ilo::xmlapi::mode::components::ctrl;
+
+use strict;
+use warnings;
+
+sub load { }
+
+sub check {
+ my ($self) = @_;
+
+ $self->{output}->output_add(long_msg => "Checking controllers");
+ $self->{components}->{ctrl} = {name => 'ctrl', total => 0, skip => 0};
+ return if ($self->check_filter(section => 'ctrl'));
+ return if (!defined($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{STORAGE}->{CONTROLLER}));
+
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ foreach my $result (@{$self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{STORAGE}->{CONTROLLER}}) {
+ my $instance = $result->{LABEL}->{VALUE};
+
+ next if ($self->check_filter(section => 'ctrl', instance => $instance));
+ next if ($result->{STATUS}->{VALUE} =~ /not installed|n\/a|not present|not applicable/i &&
+ $self->absent_problem(section => 'ctrl', instance => $instance));
+
+ $self->{components}->{ctrl}->{total}++;
+
+ $self->{output}->output_add(long_msg => sprintf("controller '%s' status is '%s' [instance = %s]",
+ $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}, $instance));
+
+ my $exit = $self->get_severity(label => 'default', section => 'ctrl', value => $result->{STATUS}->{VALUE});
+ if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
+ $self->{output}->output_add(severity => $exit,
+ short_msg => sprintf("Controller '%s' status is '%s'", $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}));
+ }
+ }
+}
+
+1;
\ No newline at end of file
diff --git a/hardware/server/hp/ilo/xmlapi/mode/components/driveencl.pm b/hardware/server/hp/ilo/xmlapi/mode/components/driveencl.pm
new file mode 100644
index 000000000..20569c70e
--- /dev/null
+++ b/hardware/server/hp/ilo/xmlapi/mode/components/driveencl.pm
@@ -0,0 +1,69 @@
+#
+# Copyright 2016 Centreon (http://www.centreon.com/)
+#
+# Centreon is a full-fledged industry-strength solution that meets
+# the needs in IT infrastructure and application monitoring for
+# service performance.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package hardware::server::hp::ilo::xmlapi::mode::components::driveencl;
+
+use strict;
+use warnings;
+
+sub load { }
+
+sub check {
+ my ($self) = @_;
+
+ $self->{output}->output_add(long_msg => "Checking drive enclosures");
+ $self->{components}->{driveencl} = {name => 'driveencl', total => 0, skip => 0};
+ return if ($self->check_filter(section => 'driveencl'));
+ return if (!defined($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{STORAGE}->{CONTROLLER}));
+
+ #
+ #
+ # ...
+ #
+ #
+ #
+ #
+ #
+ #
+ foreach my $ctrl (@{$self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{STORAGE}->{CONTROLLER}}) {
+ next if (!defined($ctrl->{DRIVE_ENCLOSURE}));
+
+ foreach my $result (@{$ctrl->{DRIVE_ENCLOSURE}}) {
+ my $instance = $result->{LABEL}->{VALUE};
+
+ next if ($self->check_filter(section => 'driveencl', instance => $instance));
+ next if ($result->{STATUS}->{VALUE} =~ /not installed|n\/a|not present|not applicable/i &&
+ $self->absent_problem(section => 'driveencl', instance => $instance));
+
+ $self->{components}->{driveencl}->{total}++;
+
+ $self->{output}->output_add(long_msg => sprintf("drive enclosure '%s' status is '%s' [instance = %s]",
+ $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}, $instance));
+
+ my $exit = $self->get_severity(label => 'default', section => 'driveencl', value => $result->{STATUS}->{VALUE});
+ if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
+ $self->{output}->output_add(severity => $exit,
+ short_msg => sprintf("Drive enclosure '%s' status is '%s'", $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}));
+ }
+ }
+ }
+}
+
+1;
\ No newline at end of file
diff --git a/hardware/server/hp/ilo/xmlapi/mode/components/fan.pm b/hardware/server/hp/ilo/xmlapi/mode/components/fan.pm
new file mode 100644
index 000000000..66674095f
--- /dev/null
+++ b/hardware/server/hp/ilo/xmlapi/mode/components/fan.pm
@@ -0,0 +1,83 @@
+#
+# Copyright 2016 Centreon (http://www.centreon.com/)
+#
+# Centreon is a full-fledged industry-strength solution that meets
+# the needs in IT infrastructure and application monitoring for
+# service performance.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package hardware::server::hp::ilo::xmlapi::mode::components::fan;
+
+use strict;
+use warnings;
+
+my %map_speed_unit = (
+ 'percentage' => '%',
+);
+
+sub load {}
+
+sub check {
+ my ($self) = @_;
+
+ $self->{output}->output_add(long_msg => "Checking fans");
+ $self->{components}->{fan} = {name => 'fans', total => 0, skip => 0};
+ return if ($self->check_filter(section => 'fan'));
+ return if (!defined($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{FANS}->{FAN}));
+
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ foreach my $result (@{$self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{FANS}->{FAN}}) {
+ my $instance = $result->{LABEL}->{VALUE};
+
+ next if ($self->check_filter(section => 'fan', instance => $instance));
+ next if ($result->{STATUS}->{VALUE} =~ /not installed|n\/a|not present|not applicable/i &&
+ $self->absent_problem(section => 'fan', instance => $instance));
+
+ $self->{components}->{fan}->{total}++;
+
+ $self->{output}->output_add(long_msg => sprintf("fan '%s' status is '%s' [instance = %s] [value = %s]",
+ $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}, $instance,
+ $result->{SPEED}->{VALUE}));
+
+ my $exit = $self->get_severity(label => 'default', section => 'fan', value => $result->{STATUS}->{VALUE});
+ if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
+ $self->{output}->output_add(severity => $exit,
+ short_msg => sprintf("Fan '%s' status is '%s'", $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}));
+ }
+
+ next if ($result->{SPEED}->{VALUE} !~ /[0-9]/);
+ my $unit = $map_speed_unit{lc($result->{SPEED}->{UNIT})};
+ my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, value => $result->{SPEED}->{VALUE});
+ if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
+ $self->{output}->output_add(severity => $exit2,
+ short_msg => sprintf("Fan '%s' is %s %s", $result->{LABEL}->{VALUE}, $result->{SPEED}->{VALUE}, $unit));
+ }
+ $self->{output}->perfdata_add(label => 'fan_' . $instance, unit => $unit,
+ value => $result->{SPEED}->{VALUE},
+ warning => $warn,
+ critical => $crit,
+ min => 0
+ );
+ }
+}
+
+1;
\ No newline at end of file
diff --git a/hardware/server/hp/ilo/xmlapi/mode/components/ldrive.pm b/hardware/server/hp/ilo/xmlapi/mode/components/ldrive.pm
new file mode 100644
index 000000000..13a8ad3ae
--- /dev/null
+++ b/hardware/server/hp/ilo/xmlapi/mode/components/ldrive.pm
@@ -0,0 +1,72 @@
+#
+# Copyright 2016 Centreon (http://www.centreon.com/)
+#
+# Centreon is a full-fledged industry-strength solution that meets
+# the needs in IT infrastructure and application monitoring for
+# service performance.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package hardware::server::hp::ilo::xmlapi::mode::components::ldrive;
+
+use strict;
+use warnings;
+
+sub load { }
+
+sub check {
+ my ($self) = @_;
+
+ $self->{output}->output_add(long_msg => "Checking logical drives");
+ $self->{components}->{ldrive} = {name => 'ldrive', total => 0, skip => 0};
+ return if ($self->check_filter(section => 'ldrive'));
+
+ return if (!defined($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{STORAGE}->{CONTROLLER}));
+
+ #
+ #
+ # ...
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ foreach my $ctrl (@{$self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{STORAGE}->{CONTROLLER}}) {
+ next if (!defined($ctrl->{LOGICAL_DRIVE}));
+
+ foreach my $result (@{$ctrl->{LOGICAL_DRIVE}}) {
+ my $instance = $result->{LABEL}->{VALUE};
+
+ next if ($self->check_filter(section => 'ldrive', instance => $instance));
+ next if ($result->{STATUS}->{VALUE} =~ /not installed|n\/a|not present|not applicable/i &&
+ $self->absent_problem(section => 'ldrive', instance => $instance));
+
+ $self->{components}->{ldrive}->{total}++;
+
+ $self->{output}->output_add(long_msg => sprintf("logical drive '%s' status is '%s' [instance = %s]",
+ $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}, $instance));
+
+ my $exit = $self->get_severity(label => 'default', section => 'ldrive', value => $result->{STATUS}->{VALUE});
+ if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
+ $self->{output}->output_add(severity => $exit,
+ short_msg => sprintf("Logical drive '%s' status is '%s'", $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}));
+ }
+ }
+ }
+}
+
+1;
\ No newline at end of file
diff --git a/hardware/server/hp/ilo/xmlapi/mode/components/memory.pm b/hardware/server/hp/ilo/xmlapi/mode/components/memory.pm
new file mode 100644
index 000000000..145ca09fd
--- /dev/null
+++ b/hardware/server/hp/ilo/xmlapi/mode/components/memory.pm
@@ -0,0 +1,74 @@
+#
+# Copyright 2016 Centreon (http://www.centreon.com/)
+#
+# Centreon is a full-fledged industry-strength solution that meets
+# the needs in IT infrastructure and application monitoring for
+# service performance.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package hardware::server::hp::ilo::xmlapi::mode::components::memory;
+
+use strict;
+use warnings;
+
+sub load { }
+
+sub check {
+ my ($self) = @_;
+
+ $self->{output}->output_add(long_msg => "Checking memories");
+ $self->{components}->{memory} = {name => 'memory', total => 0, skip => 0};
+ return if ($self->check_filter(section => 'memory'));
+ return if (!defined($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{MEMORY}->{MEMORY_DETAILS}));
+
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ foreach my $cpu_name (sort keys %{$self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{MEMORY}->{MEMORY_DETAILS}}) {
+ $self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{MEMORY}->{MEMORY_DETAILS}->{$cpu_name} = [$self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{MEMORY}->{MEMORY_DETAILS}->{$cpu_name}]
+ if (ref($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{MEMORY}->{MEMORY_DETAILS}->{$cpu_name}) ne 'ARRAY');
+ foreach my $result (@{$self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{MEMORY}->{MEMORY_DETAILS}->{$cpu_name}}) {
+ my $instance = lc($cpu_name) . '.' . $result->{SOCKET}->{VALUE};
+
+ next if ($self->check_filter(section => 'memory', instance => $instance));
+ next if ($result->{STATUS}->{VALUE} =~ /not installed|n\/a|not present|not applicable/i &&
+ $self->absent_problem(section => 'memory', instance => $instance));
+
+ $self->{components}->{memory}->{total}++;
+
+ $self->{output}->output_add(long_msg => sprintf("memory '%s' status is '%s' [instance = %s]",
+ $instance, $result->{STATUS}->{VALUE}, $instance));
+
+ my $exit = $self->get_severity(label => 'default', section => 'memory', value => $result->{STATUS}->{VALUE});
+ if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
+ $self->{output}->output_add(severity => $exit,
+ short_msg => sprintf("Memory '%s' status is '%s'", $instance, $result->{STATUS}->{VALUE}));
+ }
+ }
+ }
+}
+
+1;
\ No newline at end of file
diff --git a/hardware/server/hp/ilo/xmlapi/mode/components/nic.pm b/hardware/server/hp/ilo/xmlapi/mode/components/nic.pm
new file mode 100644
index 000000000..3d2331de5
--- /dev/null
+++ b/hardware/server/hp/ilo/xmlapi/mode/components/nic.pm
@@ -0,0 +1,65 @@
+#
+# Copyright 2016 Centreon (http://www.centreon.com/)
+#
+# Centreon is a full-fledged industry-strength solution that meets
+# the needs in IT infrastructure and application monitoring for
+# service performance.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package hardware::server::hp::ilo::xmlapi::mode::components::nic;
+
+use strict;
+use warnings;
+
+sub load { }
+
+sub check {
+ my ($self) = @_;
+
+ $self->{output}->output_add(long_msg => "Checking nic");
+ $self->{components}->{nic} = {name => 'nic', total => 0, skip => 0};
+ return if ($self->check_filter(section => 'nic'));
+ return if (!defined($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{NIC_INFORMATION}->{NIC}));
+
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ foreach my $result (@{$self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{NIC_INFORMATION}->{NIC}}) {
+ my $instance = $result->{NETWORK_PORT}->{VALUE};
+
+ next if ($self->check_filter(section => 'nic', instance => $instance));
+ next if ($result->{STATUS}->{VALUE} =~ /not installed|n\/a|not present|not applicable/i &&
+ $self->absent_problem(section => 'nic', instance => $instance));
+
+ $self->{components}->{nic}->{total}++;
+
+ $self->{output}->output_add(long_msg => sprintf("nic '%s' status is '%s' [instance = %s]",
+ $instance, $result->{STATUS}->{VALUE}, $instance));
+
+ my $exit = $self->get_severity(section => 'nic', value => $result->{STATUS}->{VALUE});
+ if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
+ $self->{output}->output_add(severity => $exit,
+ short_msg => sprintf("NIC '%s' status is '%s'", $instance, $result->{STATUS}->{VALUE}));
+ }
+ }
+}
+
+1;
\ No newline at end of file
diff --git a/hardware/server/hp/ilo/xmlapi/mode/components/pdrive.pm b/hardware/server/hp/ilo/xmlapi/mode/components/pdrive.pm
new file mode 100644
index 000000000..e2adeabe3
--- /dev/null
+++ b/hardware/server/hp/ilo/xmlapi/mode/components/pdrive.pm
@@ -0,0 +1,117 @@
+#
+# Copyright 2016 Centreon (http://www.centreon.com/)
+#
+# Centreon is a full-fledged industry-strength solution that meets
+# the needs in IT infrastructure and application monitoring for
+# service performance.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package hardware::server::hp::ilo::xmlapi::mode::components::pdrive;
+
+use strict;
+use warnings;
+
+sub load { }
+
+sub check_ilo4 {
+ my ($self) = @_;
+
+ return if (!defined($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{STORAGE}->{CONTROLLER}));
+
+ #
+ #
+ # ...
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ foreach my $ctrl (@{$self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{STORAGE}->{CONTROLLER}}) {
+ next if (!defined($ctrl->{LOGICAL_DRIVE}));
+
+ foreach my $ldrive (@{$ctrl->{LOGICAL_DRIVE}}) {
+ next if (!defined($ldrive->{PHYSICAL_DRIVE}));
+
+ foreach my $result (@{$ldrive->{PHYSICAL_DRIVE}}) {
+ my $instance = $result->{LABEL}->{VALUE};
+
+ next if ($self->check_filter(section => 'pdrive', instance => $instance));
+ next if ($result->{STATUS}->{VALUE} =~ /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->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}, $instance));
+
+ my $exit = $self->get_severity(label => 'default', section => 'pdrive', value => $result->{STATUS}->{VALUE});
+ 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->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}));
+ }
+ }
+ }
+ }
+}
+
+sub check_ilo2 {
+ my ($self) = @_;
+
+ return if (!defined($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{DRIVES}->{DRIVE_BAY}));
+ # In ILO2:
+ #
+ #
+ #
+ #
+ #
+ foreach my $result (@{$self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{DRIVES}->{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) = @_;
+
+ $self->{output}->output_add(long_msg => "Checking physical drives");
+ $self->{components}->{pdrive} = {name => 'pdrive', total => 0, skip => 0};
+ return if ($self->check_filter(section => 'pdrive'));
+
+ check_ilo4($self);
+ check_ilo2($self);
+}
+
+1;
\ No newline at end of file
diff --git a/hardware/server/hp/ilo/xmlapi/mode/components/psu.pm b/hardware/server/hp/ilo/xmlapi/mode/components/psu.pm
new file mode 100644
index 000000000..d1dda1732
--- /dev/null
+++ b/hardware/server/hp/ilo/xmlapi/mode/components/psu.pm
@@ -0,0 +1,69 @@
+#
+# Copyright 2016 Centreon (http://www.centreon.com/)
+#
+# Centreon is a full-fledged industry-strength solution that meets
+# the needs in IT infrastructure and application monitoring for
+# service performance.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package hardware::server::hp::ilo::xmlapi::mode::components::psu;
+
+use strict;
+use warnings;
+
+sub load { }
+
+sub check {
+ my ($self) = @_;
+
+ $self->{output}->output_add(long_msg => "Checking power supplies");
+ $self->{components}->{psu} = {name => 'psu', total => 0, skip => 0};
+ return if ($self->check_filter(section => 'psu'));
+ return if (!defined($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{POWER_SUPPLIES}->{SUPPLY}));
+
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ foreach my $result (@{$self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{POWER_SUPPLIES}->{SUPPLY}}) {
+ my $instance = $result->{LABEL}->{VALUE};
+
+ next if ($self->check_filter(section => 'psu', instance => $instance));
+ next if ($result->{STATUS}->{VALUE} =~ /not installed|n\/a|not present|not applicable/i &&
+ $self->absent_problem(section => 'psu', instance => $instance));
+
+ $self->{components}->{psu}->{total}++;
+
+ $self->{output}->output_add(long_msg => sprintf("power supply '%s' status is '%s' [instance = %s]",
+ $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}, $instance));
+
+ my $exit = $self->get_severity(label => 'default', section => 'psu', value => $result->{STATUS}->{VALUE});
+ if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
+ $self->{output}->output_add(severity => $exit,
+ short_msg => sprintf("Power supply '%s' status is '%s'", $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}));
+ }
+ }
+}
+
+1;
\ No newline at end of file
diff --git a/hardware/server/hp/ilo/xmlapi/mode/components/temperature.pm b/hardware/server/hp/ilo/xmlapi/mode/components/temperature.pm
new file mode 100644
index 000000000..76bcfd50b
--- /dev/null
+++ b/hardware/server/hp/ilo/xmlapi/mode/components/temperature.pm
@@ -0,0 +1,83 @@
+#
+# Copyright 2016 Centreon (http://www.centreon.com/)
+#
+# Centreon is a full-fledged industry-strength solution that meets
+# the needs in IT infrastructure and application monitoring for
+# service performance.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package hardware::server::hp::ilo::xmlapi::mode::components::temperature;
+
+use strict;
+use warnings;
+
+my %map_unit = (
+ 'celsius' => 'C',
+);
+
+sub load { }
+
+sub check {
+ my ($self) = @_;
+
+ $self->{output}->output_add(long_msg => "Checking temperatures");
+ $self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0};
+ return if ($self->check_filter(section => 'temperature'));
+ return if (!defined($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{TEMPERATURE}->{TEMP}));
+
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ foreach my $result (@{$self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{TEMPERATURE}->{TEMP}}) {
+ my $instance = $result->{LABEL}->{VALUE};
+
+ next if ($self->check_filter(section => 'temperature', instance => $instance));
+ next if ($result->{STATUS}->{VALUE} =~ /not installed|n\/a|not present|not applicable/i &&
+ $self->absent_problem(section => 'temperature', instance => $instance));
+
+ $self->{components}->{temperature}->{total}++;
+
+ $self->{output}->output_add(long_msg => sprintf("temperature '%s' status is '%s' [instance = %s] [location = %s] [value = %s]",
+ $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}, $instance, $result->{LOCATION}->{VALUE},
+ $result->{CURRENTREADING}->{VALUE}));
+
+ my $exit = $self->get_severity(label => 'default', section => 'temperature', value => $result->{STATUS}->{VALUE});
+ if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
+ $self->{output}->output_add(severity => $exit,
+ short_msg => sprintf("Temperature '%s' status is '%s'", $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}));
+ }
+
+ next if ($result->{CURRENTREADING}->{VALUE} !~ /[0-9]/);
+ my $unit = $map_unit{lc($result->{CURRENTREADING}->{UNIT})};
+ my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{CURRENTREADING}->{VALUE});
+ if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
+ $self->{output}->output_add(severity => $exit2,
+ short_msg => sprintf("Temperature '%s' is %s %s", $result->{LABEL}->{VALUE}, $result->{CURRENTREADING}->{VALUE}, $unit));
+ }
+ $self->{output}->perfdata_add(label => 'temp_' . $instance, unit => $unit,
+ value => $result->{CURRENTREADING}->{VALUE},
+ warning => $warn,
+ critical => $crit,
+ );
+ }
+}
+
+1;
\ No newline at end of file
diff --git a/hardware/server/hp/ilo/xmlapi/mode/components/vrm.pm b/hardware/server/hp/ilo/xmlapi/mode/components/vrm.pm
new file mode 100644
index 000000000..9af5b1e7a
--- /dev/null
+++ b/hardware/server/hp/ilo/xmlapi/mode/components/vrm.pm
@@ -0,0 +1,61 @@
+#
+# Copyright 2016 Centreon (http://www.centreon.com/)
+#
+# Centreon is a full-fledged industry-strength solution that meets
+# the needs in IT infrastructure and application monitoring for
+# service performance.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package hardware::server::hp::ilo::xmlapi::mode::components::vrm;
+
+use strict;
+use warnings;
+
+sub load { }
+
+sub check {
+ my ($self) = @_;
+
+ $self->{output}->output_add(long_msg => "Checking vrm");
+ $self->{components}->{vrm} = {name => 'vrm', total => 0, skip => 0};
+ return if ($self->check_filter(section => 'vrm'));
+ return if (!defined($self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{VRM}->{MODULE}));
+
+ #
+ #
+ #
+ #
+ #
+ foreach my $result (@{$self->{xml_result}->{GET_EMBEDDED_HEALTH_DATA}->{VRM}->{MODULE}}) {
+ my $instance = $result->{LABEL}->{VALUE};
+
+ next if ($self->check_filter(section => 'vrm', instance => $instance));
+ next if ($result->{STATUS}->{VALUE} =~ /not installed|n\/a|not present|not applicable/i &&
+ $self->absent_problem(section => 'vrm', instance => $instance));
+
+ $self->{components}->{vrm}->{total}++;
+
+ $self->{output}->output_add(long_msg => sprintf("vrm '%s' status is '%s' [instance = %s]",
+ $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}, $instance));
+
+ my $exit = $self->get_severity(label => 'default', section => 'vrm', value => $result->{STATUS}->{VALUE});
+ if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
+ $self->{output}->output_add(severity => $exit,
+ short_msg => sprintf("VRM '%s' status is '%s'", $result->{LABEL}->{VALUE}, $result->{STATUS}->{VALUE}));
+ }
+ }
+}
+
+1;
\ No newline at end of file
diff --git a/hardware/server/hp/ilo/xmlapi/mode/hardware.pm b/hardware/server/hp/ilo/xmlapi/mode/hardware.pm
new file mode 100644
index 000000000..e7c6c8832
--- /dev/null
+++ b/hardware/server/hp/ilo/xmlapi/mode/hardware.pm
@@ -0,0 +1,128 @@
+#
+# Copyright 2016 Centreon (http://www.centreon.com/)
+#
+# Centreon is a full-fledged industry-strength solution that meets
+# the needs in IT infrastructure and application monitoring for
+# service performance.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package hardware::server::hp::ilo::xmlapi::mode::hardware;
+
+use base qw(centreon::plugins::templates::hardware);
+
+use strict;
+use warnings;
+
+sub set_system {
+ my ($self, %options) = @_;
+
+ $self->{regexp_threshold_overload_check_section_option} =
+ '^(temperature|fan|vrm|psu|cpu|memory|nic|battery|ctrl|driveencl|pdrive|ldrive)$';
+ $self->{regexp_threshold_numeric_check_section_option} = '^(temperature|fan)$';
+
+ $self->{cb_hook2} = 'api_execute';
+
+ $self->{thresholds} = {
+ default => [
+ ['Ok', 'OK'],
+ ['Good', 'OK'],
+ ['Not installed', 'OK'],
+ ['Not Present', 'OK'],
+ ['NOT APPLICABLE', 'OK'],
+ ['n/a', 'OK'],
+ ['Unknown', 'UNKNOWN'],
+ ['.*', 'CRITICAL'],
+ ],
+ nic => [
+ ['Ok', 'OK'],
+ ['Unknown', 'OK'],
+ ['.*', 'CRITICAL'],
+ ],
+ };
+
+ $self->{components_path} = 'hardware::server::hp::ilo::xmlapi::mode::components';
+ $self->{components_module} = ['fan', 'temperature', 'vrm', 'psu', 'cpu', 'memory', 'nic', 'battery', 'ctrl',
+ 'driveencl', 'pdrive', 'ldrive'];
+}
+
+sub api_execute {
+ my ($self, %options) = @_;
+
+ $self->{xml_result} = $options{custom}->get_ilo_data();
+}
+
+sub new {
+ my ($class, %options) = @_;
+ my $self = $class->SUPER::new(package => __PACKAGE__, %options);
+ bless $self, $class;
+
+ $self->{version} = '1.0';
+ $options{options}->add_options(arguments =>
+ {
+ });
+
+ return $self;
+}
+
+1;
+
+__END__
+
+=head1 MODE
+
+Check hardware.
+
+=over 8
+
+=item B<--component>
+
+Which component to check (Default: '.*').
+Can be: 'fan', 'temperature', 'vrm', 'psu', 'cpu', 'memory', 'nic', 'battery', 'ctrl',
+'driveencl', 'pdrive', 'ldrive'.
+
+=item B<--filter>
+
+Exclude some parts (comma seperated list) (Example: --filter=temperature --filter=fan)
+Can also exclude specific instance: --filter="fan,Fan Block 1"
+
+=item B<--absent-problem>
+
+Return an error if an entity is not 'present' (default is skipping)
+Can be specific or global: --absent-problem="fan,Fan Block 1"
+
+=item B<--no-component>
+
+Return an error if no compenents are checked.
+If total (with skipped) is 0. (Default: 'critical' returns).
+
+=item B<--threshold-overload>
+
+Set to overload default threshold values (syntax: section,[instance,]status,regexp)
+It used before default thresholds (order stays).
+Example: --threshold-overload='fan,OK,degraded'
+
+=item B<--warning>
+
+Set warning threshold for 'temperature', 'fan' (syntax: type,regexp,threshold)
+Example: --warning='temperature,.*,30'
+
+=item B<--critical>
+
+Set critical threshold for 'temperature', 'fan' (syntax: type,regexp,threshold)
+Example: --critical='temperature,.*,50'
+
+=back
+
+=cut
diff --git a/hardware/server/hp/ilo/xmlapi/plugin.pm b/hardware/server/hp/ilo/xmlapi/plugin.pm
new file mode 100644
index 000000000..e989c53eb
--- /dev/null
+++ b/hardware/server/hp/ilo/xmlapi/plugin.pm
@@ -0,0 +1,49 @@
+#
+# Copyright 2016 Centreon (http://www.centreon.com/)
+#
+# Centreon is a full-fledged industry-strength solution that meets
+# the needs in IT infrastructure and application monitoring for
+# service performance.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package hardware::server::hp::ilo::xmlapi::plugin;
+
+use strict;
+use warnings;
+use base qw(centreon::plugins::script_custom);
+
+sub new {
+ my ($class, %options) = @_;
+ my $self = $class->SUPER::new(package => __PACKAGE__, %options);
+ bless $self, $class;
+
+ $self->{version} = '1.0';
+ %{$self->{modes}} = (
+ 'hardware' => 'hardware::server::hp::ilo::xmlapi::mode::hardware',
+ );
+
+ $self->{custom_modes}{api} = 'hardware::server::hp::ilo::xmlapi::custom::api';
+ return $self;
+}
+
+1;
+
+__END__
+
+=head1 PLUGIN DESCRIPTION
+
+Check HP ILO (ilo 2/3/4) with XML API.
+
+=cut