From eeed070febc3f9fd07c849839d0d878989e9e2cc Mon Sep 17 00:00:00 2001 From: qgarnier Date: Wed, 4 Aug 2021 09:45:32 +0200 Subject: [PATCH] enh(hp/ilo/restapi): hardware - add default warning temperature threshold (#3014) --- .../common/redfish/restapi/mode/components/temperature.pm | 7 ++++--- centreon-plugins/hardware/server/hp/ilo/restapi/plugin.pm | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/centreon-plugins/centreon/common/redfish/restapi/mode/components/temperature.pm b/centreon-plugins/centreon/common/redfish/restapi/mode/components/temperature.pm index 4e008319f..624f8a4d9 100644 --- a/centreon-plugins/centreon/common/redfish/restapi/mode/components/temperature.pm +++ b/centreon-plugins/centreon/common/redfish/restapi/mode/components/temperature.pm @@ -45,7 +45,7 @@ sub check { $temp->{Status}->{Health} = defined($temp->{Status}->{Health}) ? $temp->{Status}->{Health} : 'n/a'; next if ($self->check_filter(section => 'temperature', instance => $instance)); $self->{components}->{temperature}->{total}++; - + $self->{output}->output_add( long_msg => sprintf( "temperature '%s/%s' status is '%s' [instance: %s, state: %s, value: %s]", @@ -78,9 +78,10 @@ sub check { my $crit_th = defined($temp->{UpperThresholdFatal}) ? ':' . $temp->{UpperThresholdFatal} : ''; $self->{perfdata}->threshold_validate(label => 'warning-temperature-instance-' . $instance, value => $warn_th); $self->{perfdata}->threshold_validate(label => 'critical-temperature-instance-' . $instance, value => $crit_th); + $warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-temperature-instance-' . $instance); $crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $instance); } - + if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { $self->{output}->output_add( severity => $exit2, @@ -96,7 +97,7 @@ sub check { instances => [$chassis_name, $temp_name], value => $temp->{ReadingCelsius}, warning => $warn, - critical => $crit, + critical => $crit ); } } diff --git a/centreon-plugins/hardware/server/hp/ilo/restapi/plugin.pm b/centreon-plugins/hardware/server/hp/ilo/restapi/plugin.pm index 22ad0116c..a905ff35a 100644 --- a/centreon-plugins/hardware/server/hp/ilo/restapi/plugin.pm +++ b/centreon-plugins/hardware/server/hp/ilo/restapi/plugin.pm @@ -30,11 +30,11 @@ sub new { bless $self, $class; $self->{version} = '0.1'; - %{ $self->{modes} } = ( - 'hardware' => 'centreon::common::redfish::restapi::mode::hardware', - ); + $self->{modes} = { + 'hardware' => 'centreon::common::redfish::restapi::mode::hardware' + }; - $self->{custom_modes}{api} = 'hardware::server::hp::ilo::restapi::custom::api'; + $self->{custom_modes}->{api} = 'hardware::server::hp::ilo::restapi::custom::api'; return $self; }