2015-01-27 14:48:15 +01:00
|
|
|
#
|
2020-01-06 15:19:23 +01:00
|
|
|
# Copyright 2020 Centreon (http://www.centreon.com/)
|
2015-07-21 11:51:02 +02:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
2015-01-27 14:48:15 +01:00
|
|
|
|
|
|
|
package hardware::server::dell::idrac::snmp::mode::components::temperature;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
2016-02-13 23:39:09 +01:00
|
|
|
use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_probe_status %map_state);
|
2015-01-27 14:48:15 +01:00
|
|
|
|
|
|
|
my %map_temp_type = (
|
|
|
|
1 => 'temperatureProbeTypeIsOther',
|
|
|
|
2 => 'temperatureProbeTypeIsUnknown',
|
|
|
|
3 => 'temperatureProbeTypeIsAmbientESM',
|
|
|
|
16 => 'temperatureProbeTypeIsDiscrete',
|
|
|
|
);
|
|
|
|
|
|
|
|
my $mapping = {
|
2016-02-13 23:39:09 +01:00
|
|
|
temperatureProbeStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.4', map => \%map_state },
|
|
|
|
temperatureProbeStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.5', map => \%map_probe_status },
|
2015-01-27 14:48:15 +01:00
|
|
|
temperatureProbeReading => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.6' },
|
|
|
|
temperatureProbeType => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.7', map => \%map_temp_type },
|
|
|
|
temperatureProbeLocationName => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.8' },
|
|
|
|
temperatureProbeUpperCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.10' },
|
2016-02-13 23:39:09 +01:00
|
|
|
temperatureProbeUpperNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.11' },
|
|
|
|
temperatureProbeLowerNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.12' },
|
|
|
|
temperatureProbeLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.13' },
|
2015-01-27 14:48:15 +01:00
|
|
|
};
|
|
|
|
my $oid_temperatureProbeTableEntry = '.1.3.6.1.4.1.674.10892.5.4.700.20.1';
|
|
|
|
|
|
|
|
sub load {
|
2016-02-13 23:39:09 +01:00
|
|
|
my ($self) = @_;
|
2015-01-27 14:48:15 +01:00
|
|
|
|
2020-04-21 11:38:50 +02:00
|
|
|
push @{$self->{request}}, {
|
|
|
|
oid => $oid_temperatureProbeTableEntry,
|
|
|
|
start => $mapping->{temperatureProbeStateSettings}->{oid},
|
|
|
|
end => $mapping->{temperatureProbeLowerCriticalThreshold}->{oid}
|
|
|
|
};
|
2015-01-27 14:48:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sub check {
|
|
|
|
my ($self) = @_;
|
|
|
|
|
|
|
|
$self->{output}->output_add(long_msg => "Checking temperatures");
|
|
|
|
$self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0};
|
2016-02-13 23:39:09 +01:00
|
|
|
return if ($self->check_filter(section => 'temperature'));
|
2015-01-27 14:48:15 +01:00
|
|
|
|
|
|
|
foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_temperatureProbeTableEntry}})) {
|
|
|
|
next if ($oid !~ /^$mapping->{temperatureProbeStatus}->{oid}\.(.*)$/);
|
|
|
|
my $instance = $1;
|
|
|
|
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_temperatureProbeTableEntry}, instance => $instance);
|
|
|
|
|
2016-02-13 23:39:09 +01:00
|
|
|
next if ($self->check_filter(section => 'temperature', instance => $instance));
|
2015-01-27 14:48:15 +01:00
|
|
|
$self->{components}->{temperature}->{total}++;
|
|
|
|
|
|
|
|
$result->{temperatureProbeReading} = (defined($result->{temperatureProbeReading})) ? $result->{temperatureProbeReading} / 10 : 'unknown';
|
2016-02-13 23:39:09 +01:00
|
|
|
$self->{output}->output_add(long_msg => sprintf("temperature '%s' status is '%s' [instance = %s] [state = %s] [value = %s]",
|
2015-01-27 14:48:15 +01:00
|
|
|
$result->{temperatureProbeLocationName}, $result->{temperatureProbeStatus}, $instance,
|
|
|
|
$result->{temperatureProbeStateSettings}, $result->{temperatureProbeReading}));
|
|
|
|
|
2016-02-13 23:39:09 +01:00
|
|
|
my $exit = $self->get_severity(label => 'default.state', section => 'temperature.state', value => $result->{temperatureProbeStateSettings});
|
2015-01-27 14:48:15 +01:00
|
|
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
|
|
|
$self->{output}->output_add(severity => $exit,
|
|
|
|
short_msg => sprintf("Temperature '%s' state is '%s'", $result->{temperatureProbeLocationName}, $result->{temperatureProbeStateSettings}));
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
2016-02-13 23:39:09 +01:00
|
|
|
$exit = $self->get_severity(label => 'probe.status', section => 'temperature.status', value => $result->{temperatureProbeStatus});
|
2015-01-27 14:48:15 +01:00
|
|
|
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->{temperatureProbeLocationName}, $result->{temperatureProbeStatus}));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (defined($result->{temperatureProbeReading}) && $result->{temperatureProbeReading} =~ /[0-9]/) {
|
|
|
|
my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{temperatureProbeReading});
|
|
|
|
if ($checked == 0) {
|
2016-02-13 23:39:09 +01:00
|
|
|
$result->{temperatureProbeLowerNonCriticalThreshold} = (defined($result->{temperatureProbeLowerNonCriticalThreshold}) && $result->{temperatureProbeLowerNonCriticalThreshold} =~ /[0-9]/) ?
|
|
|
|
$result->{temperatureProbeLowerNonCriticalThreshold} / 10 : '';
|
|
|
|
$result->{temperatureProbeLowerCriticalThreshold} = (defined($result->{temperatureProbeLowerCriticalThreshold}) && $result->{temperatureProbeLowerCriticalThreshold} =~ /[0-9]/) ?
|
|
|
|
$result->{temperatureProbeLowerCriticalThreshold} / 10 : '';
|
|
|
|
$result->{temperatureProbeUpperNonCriticalThreshold} = (defined($result->{temperatureProbeUpperNonCriticalThreshold}) && $result->{temperatureProbeUpperNonCriticalThreshold} =~ /[0-9]/) ?
|
|
|
|
$result->{temperatureProbeUpperNonCriticalThreshold} / 10 : '';
|
|
|
|
$result->{temperatureProbeUpperCriticalThreshold} = (defined($result->{temperatureProbeUpperCriticalThreshold}) && $result->{temperatureProbeUpperCriticalThreshold} =~ /[0-9]/) ?
|
|
|
|
$result->{temperatureProbeUpperCriticalThreshold} / 10 : '';
|
|
|
|
my $warn_th = $result->{temperatureProbeLowerNonCriticalThreshold} . ':' . $result->{temperatureProbeUpperNonCriticalThreshold};
|
2015-01-27 14:48:15 +01:00
|
|
|
my $crit_th = $result->{temperatureProbeLowerCriticalThreshold} . ':' . $result->{temperatureProbeUpperCriticalThreshold};
|
|
|
|
$self->{perfdata}->threshold_validate(label => 'warning-temperature-instance-' . $instance, value => $warn_th);
|
|
|
|
$self->{perfdata}->threshold_validate(label => 'critical-temperature-instance-' . $instance, value => $crit_th);
|
|
|
|
|
|
|
|
$exit = $self->{perfdata}->threshold_check(value => $result->{temperatureProbeReading}, threshold => [ { label => 'critical-temperature-instance-' . $instance, exit_litteral => 'critical' },
|
|
|
|
{ label => 'warning-temperature-instance-' . $instance, exit_litteral => 'warning' } ]);
|
|
|
|
$warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-temperature-instance-' . $instance);
|
2016-02-28 15:56:51 +01:00
|
|
|
$crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $instance);
|
2015-01-27 14:48:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
|
|
|
$self->{output}->output_add(severity => $exit,
|
|
|
|
short_msg => sprintf("Temperature '%s' is %s degree centigrade", $result->{temperatureProbeLocationName}, $result->{temperatureProbeReading}));
|
|
|
|
}
|
2019-04-18 11:35:29 +02:00
|
|
|
$self->{output}->perfdata_add(
|
|
|
|
label => 'temp', unit => 'C',
|
|
|
|
nlabel => 'hardware.probe.temperature.celsius',
|
|
|
|
instances => $result->{temperatureProbeLocationName},
|
|
|
|
value => $result->{temperatureProbeReading},
|
|
|
|
warning => $warn,
|
|
|
|
critical => $crit,
|
|
|
|
);
|
2015-01-27 14:48:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-18 11:35:29 +02:00
|
|
|
1;
|