centreon-plugins/storage/synology/snmp/mode/temperature.pm

94 lines
2.2 KiB
Perl
Raw Normal View History

2014-10-06 13:42:38 +02:00
#
2019-01-09 09:57:11 +01:00
# Copyright 2019 Centreon (http://www.centreon.com/)
2014-10-06 13:42:38 +02:00
#
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.
2014-10-06 13:42:38 +02:00
#
2015-07-21 11:51:02 +02:00
# 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
2014-10-06 13:42:38 +02:00
#
2015-07-21 11:51:02 +02:00
# http://www.apache.org/licenses/LICENSE-2.0
2014-10-06 13:42:38 +02:00
#
2015-07-21 11:51:02 +02:00
# 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.
2014-10-06 13:42:38 +02:00
#
2015-07-03 16:17:57 +02:00
package storage::synology::snmp::mode::temperature;
2014-10-06 13:42:38 +02:00
2019-10-16 11:40:00 +02:00
use base qw(centreon::plugins::templates::counter);
2014-10-06 13:42:38 +02:00
use strict;
use warnings;
2019-10-16 11:40:00 +02:00
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', type => 0 },
];
$self->{maps_counters}->{global} = [
2019-10-16 12:38:37 +02:00
{ label => 'temperature', nlabel => 'system.temperature.celsius', set => {
2019-10-16 11:40:00 +02:00
key_values => [ { name => 'temperature' } ],
output_template => 'system temperature: %s C',
perfdatas => [
{ value => 'temperature_absolute', template => '%s', unit => 'C' },
],
}
},
];
}
2014-10-06 13:42:38 +02:00
sub new {
my ($class, %options) = @_;
2019-10-16 11:40:00 +02:00
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
2014-10-06 13:42:38 +02:00
bless $self, $class;
2019-10-16 11:40:00 +02:00
$options{options}->add_options(arguments => {
});
2014-10-06 13:42:38 +02:00
2019-10-16 11:40:00 +02:00
return $self;
2014-10-06 13:42:38 +02:00
}
2019-10-16 11:40:00 +02:00
sub manage_selection {
2014-10-06 13:42:38 +02:00
my ($self, %options) = @_;
my $oid_synoSystemtemperature = '.1.3.6.1.4.1.6574.1.2.0'; # in Celsius
2019-10-16 11:40:00 +02:00
my $snmp_result = $options{snmp}->get_leef(
oids => [ $oid_synoSystemtemperature ],
nothing_quit => 1
);
2014-10-06 13:42:38 +02:00
2019-10-16 11:40:00 +02:00
$self->{global} = {
temperature => $snmp_result->{$oid_synoSystemtemperature},
};
2014-10-06 13:42:38 +02:00
}
1;
__END__
=head1 MODE
Check temperature (SYNOLOGY-SYSTEM-MIB).
=over 8
2019-10-16 11:40:00 +02:00
=item B<--warning-temperature>
2014-10-06 13:42:38 +02:00
Threshold warning in celsius degrees.
2019-10-16 11:40:00 +02:00
=item B<--critical-temperature>
2014-10-06 13:42:38 +02:00
Threshold critical in celsius degrees.
=back
=cut