+ update hardware.pm (add battery)

This commit is contained in:
Simon Bomm 2017-06-15 17:30:21 +02:00 committed by GitHub
parent b12775f445
commit 205a068889

View File

@ -1,5 +1,5 @@
# #
# Copyright 2017 Centreon (http://www.centreon.com/) # Copyright 2016 Centreon (http://www.centreon.com/)
# #
# Centreon is a full-fledged industry-strength solution that meets # Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for # the needs in IT infrastructure and application monitoring for
@ -27,14 +27,14 @@ use warnings;
sub set_system { sub set_system {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{regexp_threshold_overload_check_section_option} = '^(temperature|fan|psu|sysdrive)$'; $self->{regexp_threshold_overload_check_section_option} = '^(temperature|fan|psu|sysdrive|battery)$';
$self->{regexp_threshold_numeric_check_section_option} = '^(temperature|fan)$'; $self->{regexp_threshold_numeric_check_section_option} = '^(temperature|fan)$';
$self->{cb_hook2} = 'snmp_execute'; $self->{cb_hook2} = 'snmp_execute';
$self->{thresholds} = { $self->{thresholds} = {
psu => [ psu => [
['ok', 'OK'], ['ok', 'OK'],
['failed', 'CRITICAL'], ['failed', 'CRITICAL'],
['notFitted', 'WARNING'], ['notFitted', 'WARNING'],
@ -45,7 +45,7 @@ sub set_system {
['warning', 'WARNING'], ['warning', 'WARNING'],
['severe', 'CRITICAL'], ['severe', 'CRITICAL'],
['unknown', 'UNKNOWN'], ['unknown', 'UNKNOWN'],
], ],
temperature => [ temperature => [
['ok', 'OK'], ['ok', 'OK'],
['tempWarning', 'WARNING'], ['tempWarning', 'WARNING'],
@ -65,15 +65,28 @@ sub set_system {
['formatting', 'OK'], ['formatting', 'OK'],
['unknown', 'UNKNOWN'], ['unknown', 'UNKNOWN'],
], ],
battery => [
['ok', 'OK'],
['fault', 'CRITICAL'],
['notFitted', 'WARNING'],
['initializing', 'OK'],
['normalCharging', 'OK'],
['discharged', 'CRITICAL'],
['cellTesting', 'OK'],
['notResponding', 'CRITICAL'],
['low', 'WARNING'],
['veryLow', 'CRITICAL'],
['ignore', 'UNKNOWN'],
],
}; };
$self->{components_path} = 'centreon::common::bluearc::snmp::mode::components'; $self->{components_path} = 'centreon::common::bluearc::snmp::mode::components';
$self->{components_module} = ['temperature', 'fan', 'psu', 'sysdrive']; $self->{components_module} = ['temperature', 'fan', 'psu', 'sysdrive', 'battery' ];
} }
sub snmp_execute { sub snmp_execute {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{snmp} = $options{snmp}; $self->{snmp} = $options{snmp};
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request}); $self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
} }
@ -82,12 +95,12 @@ sub new {
my ($class, %options) = @_; my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1); my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1);
bless $self, $class; bless $self, $class;
$self->{version} = '1.0'; $self->{version} = '1.0';
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
}); });
return $self; return $self;
} }
@ -134,4 +147,4 @@ Example: --critical='temperature,.*,40'
=back =back
=cut =cut