centreon-plugins/hardware/sensors/hwgste/snmp/mode/sensors.pm

116 lines
3.2 KiB
Perl
Raw Normal View History

2015-08-24 16:43:11 +02:00
#
2019-01-09 09:57:11 +01:00
# Copyright 2019 Centreon (http://www.centreon.com/)
2015-08-24 16:43:11 +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.
package hardware::sensors::hwgste::snmp::mode::sensors;
2016-10-21 09:49:17 +02:00
use base qw(centreon::plugins::templates::hardware);
2015-08-24 16:43:11 +02:00
use strict;
use warnings;
2019-03-29 09:37:12 +01:00
use hardware::sensors::hwgste::snmp::mode::components::resources qw($mapping);
2015-08-24 16:43:11 +02:00
2016-10-21 09:49:17 +02:00
sub set_system {
2015-08-24 16:43:11 +02:00
my ($self, %options) = @_;
2015-08-24 16:59:11 +02:00
2016-10-21 09:49:17 +02:00
$self->{regexp_threshold_overload_check_section_option} = '^(temperature|humidity)$';
$self->{regexp_threshold_numeric_check_section_option} = '^(temperature|humidity)$';
2015-08-24 16:43:11 +02:00
2016-10-21 09:49:17 +02:00
$self->{cb_hook2} = 'snmp_execute';
2015-08-24 16:59:11 +02:00
2016-10-21 09:49:17 +02:00
$self->{thresholds} = {
default => [
['invalid', 'UNKNOWN'],
['normal', 'OK'],
['outOfRangeLo', 'WARNING'],
['outOfRangeHi', 'WARNING'],
['alarmLo', 'CRITICAL'],
['alarmHi', 'CRITICAL'],
],
};
$self->{components_path} = 'hardware::sensors::hwgste::snmp::mode::components';
$self->{components_module} = ['temperature', 'humidity'];
2015-08-24 16:59:11 +02:00
}
2016-10-21 09:49:17 +02:00
sub snmp_execute {
2015-08-24 16:43:11 +02:00
my ($self, %options) = @_;
2016-10-21 09:49:17 +02:00
$self->{snmp} = $options{snmp};
2019-03-29 09:37:12 +01:00
$self->{results} = $self->{snmp}->get_multiple_table(
oids => [{ oid => $mapping->{branch_sensors}->{hwgste} }, { oid => $mapping->{branch_sensors}->{hwgste2} }]
);
$self->{branch} = 'hwgste';
2019-05-19 11:04:53 +02:00
if (defined($self->{results}->{ $mapping->{branch_sensors}->{hwgste2} }) &&
scalar(keys %{$self->{results}->{ $mapping->{branch_sensors}->{hwgste2} }}) > 0) {
2019-03-29 09:37:12 +01:00
$self->{branch} = 'hwgste2';
}
2015-08-24 16:43:11 +02:00
}
2016-10-21 09:49:17 +02:00
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1);
bless $self, $class;
2015-08-24 16:43:11 +02:00
2019-03-29 09:37:12 +01:00
$options{options}->add_options(arguments => {
});
2015-08-24 16:43:11 +02:00
2016-10-21 09:49:17 +02:00
return $self;
2015-08-24 16:43:11 +02:00
}
1;
__END__
=head1 MODE
Check HWg-STE sensors.
=over 8
2016-10-21 09:49:17 +02:00
=item B<--component>
Which component to check (Default: '.*').
Can be: 'temperature', 'humidity'.
2015-08-24 16:59:11 +02:00
=item B<--filter>
Exclude some parts.
Can also exclude specific instance: --filter=sensor,10
2015-08-24 16:43:11 +02:00
=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='sensor,CRITICAL,^(?!(normal)$)'
=item B<--warning>
2016-10-21 09:49:17 +02:00
Set warning threshold for temperature, humidity (syntax: type,instance,threshold)
Example: --warning='temperature,.*,30'
2015-08-24 16:43:11 +02:00
=item B<--critical>
2016-10-21 09:49:17 +02:00
Set critical threshold for temperature, humidity (syntax: type,instance,threshold)
Example: --critical='humidty,.*,40'
2015-08-24 16:43:11 +02:00
=back
=cut