2013-12-13 16:14:12 +01:00
|
|
|
#
|
2016-01-20 19:09:18 +01:00
|
|
|
# Copyright 2016 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.
|
|
|
|
#
|
2013-12-13 16:14:12 +01:00
|
|
|
|
2014-10-05 17:37:48 +02:00
|
|
|
package hardware::server::hp::proliant::snmp::mode::hardware;
|
2013-12-13 16:14:12 +01:00
|
|
|
|
2016-12-01 17:12:29 +01:00
|
|
|
use base qw(centreon::plugins::templates::hardware);
|
2013-12-13 16:14:12 +01:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use centreon::plugins::misc;
|
2015-02-13 16:37:52 +01:00
|
|
|
|
2016-12-01 17:12:29 +01:00
|
|
|
sub set_system {
|
|
|
|
my ($self, %options) = @_;
|
|
|
|
|
|
|
|
$self->{regexp_threshold_overload_check_section_option} =
|
|
|
|
'^(ilo|cpu|idectl|ideldrive|idepdrive|pc|psu|sasctl|sasldrive|saspdrive|scsictl|scsildrive|scsipdrive|fcahostctl|fcaexternalctl|fcaexternalacc|fcaldrive|fcapdrive|dactl|daacc|daldrive|dapdrive|fan|pnic|lnic|temperature)$';
|
|
|
|
$self->{regexp_threshold_numeric_check_section_option} = '^(temperature)$';
|
|
|
|
|
|
|
|
$self->{cb_hook1} = 'get_system_information';
|
|
|
|
$self->{cb_hook2} = 'snmp_execute';
|
|
|
|
|
|
|
|
$self->{thresholds} = {
|
|
|
|
cpu => [
|
|
|
|
['unknown', 'UNKNOWN'],
|
|
|
|
['ok', 'OK'],
|
|
|
|
['degraded', 'WARNING'],
|
|
|
|
['failed', 'CRITICAL'],
|
|
|
|
['disabled', 'OK'],
|
|
|
|
],
|
|
|
|
ideldrive => [
|
|
|
|
['other', 'UNKNOWN'],
|
|
|
|
['ok', 'OK'],
|
|
|
|
['rebuilding', 'WARNING'],
|
|
|
|
['degraded', 'WARNING'],
|
|
|
|
['failed', 'CRITICAL'],
|
|
|
|
],
|
|
|
|
sasldrive => [
|
|
|
|
['other', 'UNKNOWN'],
|
|
|
|
['ok', 'OK'],
|
|
|
|
['degraded', 'WARNING'],
|
|
|
|
['rebuilding', 'WARNING'],
|
|
|
|
['failed', 'CRITICAL'],
|
|
|
|
['offline', 'CRITICAL'],
|
|
|
|
],
|
|
|
|
scsildrive => [
|
|
|
|
['other', 'UNKNOWN'],
|
|
|
|
['ok', 'OK'],
|
|
|
|
['degraded', 'WARNING'],
|
|
|
|
['failed', 'CRITICAL'],
|
|
|
|
['unconfigured', 'OK'],
|
|
|
|
['recovering', 'WARNING'],
|
|
|
|
['readyForRebuild', 'WARNING'],
|
|
|
|
['rebuilding', 'WARNING'],
|
|
|
|
['wrongDrive', 'CRITICAL'],
|
|
|
|
['badConnect', 'CRITICAL'],
|
|
|
|
['disabled', 'OK'],
|
|
|
|
],
|
|
|
|
fcaexternalaccbattery => [
|
|
|
|
['other', 'UNKNOWN'],
|
|
|
|
['ok', 'OK'],
|
|
|
|
['degraded', 'WARNING'],
|
|
|
|
['failed', 'CRITICAL'],
|
|
|
|
['recharging', 'WARNING'],
|
|
|
|
['not present', 'OK'],
|
|
|
|
],
|
|
|
|
fcaldrive => [
|
|
|
|
['other', 'UNKNOWN'],
|
|
|
|
['ok', 'OK'],
|
|
|
|
['failed', 'CRITICAL'],
|
|
|
|
['rebuilding', 'WARNING'],
|
|
|
|
['expanding', 'WARNING'],
|
|
|
|
['recovering', 'WARNING'],
|
|
|
|
['unconfigured', 'OK'],
|
|
|
|
['readyForRebuild', 'WARNING'],
|
|
|
|
['wrongDrive', 'CRITICAL'],
|
|
|
|
['badConnect', 'CRITICAL'],
|
|
|
|
['overheating', 'CRITICAL'],
|
|
|
|
['notAvailable', 'WARNING'],
|
|
|
|
['hardError', 'CRITICAL'],
|
|
|
|
['queuedForExpansion', 'WARNING'],
|
|
|
|
['shutdown', 'WARNING'],
|
|
|
|
],
|
|
|
|
daaccbattery => [
|
|
|
|
['other', 'UNKNOWN'],
|
|
|
|
['ok', 'OK'],
|
|
|
|
['degraded', 'WARNING'],
|
|
|
|
['failed', 'CRITICAL'],
|
|
|
|
['recharging', 'WARNING'],
|
|
|
|
['not present', 'OK'],
|
|
|
|
],
|
|
|
|
daldrive => [
|
|
|
|
['other', 'UNKNOWN'],
|
|
|
|
['ok', 'OK'],
|
|
|
|
['failed', 'CRITICAL'],
|
|
|
|
['rebuilding', 'WARNING'],
|
|
|
|
['expanding', 'WARNING'],
|
|
|
|
['recovering', 'WARNING'],
|
|
|
|
['unconfigured', 'OK'],
|
|
|
|
['readyForRebuild', 'WARNING'],
|
|
|
|
['wrongDrive', 'CRITICAL'],
|
|
|
|
['badConnect', 'CRITICAL'],
|
|
|
|
['overheating', 'CRITICAL'],
|
|
|
|
['notAvailable', 'WARNING'],
|
|
|
|
['hardError', 'CRITICAL'],
|
|
|
|
['queuedForExpansion', 'WARNING'],
|
|
|
|
['shutdown', 'WARNING'],
|
|
|
|
],
|
|
|
|
lnic => [
|
|
|
|
['other', 'OK'],
|
|
|
|
['ok', 'OK'],
|
|
|
|
['degraded', 'WARNING'],
|
|
|
|
['failed', 'CRITICAL'],
|
|
|
|
],
|
|
|
|
temperature => [
|
|
|
|
['other', 'OK'],
|
|
|
|
['ok', 'OK'],
|
|
|
|
['degraded', 'WARNING'],
|
|
|
|
['failed', 'CRITICAL'],
|
|
|
|
],
|
|
|
|
# ilo, pnic, fan, dapdrive, daacc, dactl, fcapdrive, fcaexternalacc, fcaexternalctl, fcahostctl, scsipdrive, scsictl, saspdrive, sasctl, psu, pc, idepdrive, idectl
|
|
|
|
default => [
|
|
|
|
['other', 'UNKNOWN'],
|
|
|
|
['ok', 'OK'],
|
|
|
|
['degraded', 'WARNING'],
|
|
|
|
['failed', 'CRITICAL'],
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
$self->{components_path} = 'hardware::server::hp::proliant::snmp::mode::components';
|
|
|
|
$self->{components_module} = ['cpu', 'idectl', 'ideldrive', 'idepdrive', 'pc', 'psu',
|
|
|
|
'sasctl', 'sasldrive', 'saspdrive', 'scsictl', 'scsildrive', 'scsipdrive',
|
|
|
|
'fcahostctl', 'fcaexternalctl', 'fcaexternalacc', 'fcaldrive', 'fcapdrive',
|
|
|
|
'dactl', 'daacc', 'daldrive', 'dapdrive', 'fan', 'pnic', 'lnic', 'temperature', 'ilo'];
|
|
|
|
}
|
|
|
|
|
|
|
|
sub snmp_execute {
|
|
|
|
my ($self, %options) = @_;
|
|
|
|
|
|
|
|
$self->{snmp} = $options{snmp};
|
|
|
|
$self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request});
|
|
|
|
}
|
2013-12-13 16:14:12 +01:00
|
|
|
|
|
|
|
sub new {
|
|
|
|
my ($class, %options) = @_;
|
|
|
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
|
|
|
bless $self, $class;
|
|
|
|
|
|
|
|
$self->{version} = '1.0';
|
|
|
|
$options{options}->add_options(arguments =>
|
2016-12-01 17:12:29 +01:00
|
|
|
{
|
2013-12-13 16:14:12 +01:00
|
|
|
});
|
2014-05-26 22:27:36 +02:00
|
|
|
|
2013-12-13 16:14:12 +01:00
|
|
|
return $self;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub check_options {
|
|
|
|
my ($self, %options) = @_;
|
2016-12-01 17:12:29 +01:00
|
|
|
$self->SUPER::check_options(%options);
|
|
|
|
|
2015-02-13 16:37:52 +01:00
|
|
|
if ($self->{option_results}->{component} =~ /storage/i) {
|
|
|
|
$self->{option_results}->{component} = '^(sas|ide|fca|da|scsi).*';
|
|
|
|
}
|
|
|
|
if ($self->{option_results}->{component} =~ /network/i) {
|
|
|
|
$self->{option_results}->{component} = '^(pnic|lnic)$';
|
|
|
|
}
|
2013-12-13 16:14:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
sub get_system_information {
|
2016-12-01 17:12:29 +01:00
|
|
|
my ($self, %options) = @_;
|
2013-12-13 16:14:12 +01:00
|
|
|
|
|
|
|
# In 'CPQSINFO-MIB'
|
2014-01-28 12:08:21 +01:00
|
|
|
my $oid_cpqSiSysSerialNum = ".1.3.6.1.4.1.232.2.2.2.1.0";
|
|
|
|
my $oid_cpqSiProductName = ".1.3.6.1.4.1.232.2.2.4.2.0";
|
|
|
|
my $oid_cpqSeSysRomVer = ".1.3.6.1.4.1.232.1.2.6.1.0";
|
2013-12-13 16:14:12 +01:00
|
|
|
|
2016-12-01 17:12:29 +01:00
|
|
|
my $result = $options{snmp}->get_leef(oids => [$oid_cpqSiSysSerialNum, $oid_cpqSiProductName, $oid_cpqSeSysRomVer]);
|
2013-12-13 16:14:12 +01:00
|
|
|
|
2016-12-01 17:12:29 +01:00
|
|
|
my $product_name = defined($result->{$oid_cpqSiProductName}) ? centreon::plugins::misc::trim($result->{$oid_cpqSiProductName}) : 'unknown';
|
|
|
|
my $serial = defined($result->{$oid_cpqSiSysSerialNum}) ? centreon::plugins::misc::trim($result->{$oid_cpqSiSysSerialNum}) : 'unknown';
|
|
|
|
my $romversion = defined($result->{$oid_cpqSeSysRomVer}) ? centreon::plugins::misc::trim($result->{$oid_cpqSeSysRomVer}) : 'unknown';
|
|
|
|
$self->{output}->output_add(long_msg => sprintf("Product Name: %s, Serial: %s, Rom Version: %s",
|
|
|
|
$product_name, $serial, $romversion)
|
|
|
|
);
|
2015-02-13 16:37:52 +01:00
|
|
|
}
|
|
|
|
|
2013-12-13 16:14:12 +01:00
|
|
|
1;
|
|
|
|
|
|
|
|
__END__
|
|
|
|
|
|
|
|
=head1 MODE
|
|
|
|
|
|
|
|
Check Hardware (CPUs, Power Supplies, Power converters, Fans).
|
|
|
|
|
|
|
|
=over 8
|
|
|
|
|
2014-02-02 22:31:38 +01:00
|
|
|
=item B<--component>
|
|
|
|
|
2015-03-10 00:46:14 +01:00
|
|
|
Which component to check (Default: '.*').
|
2015-02-13 16:37:52 +01:00
|
|
|
Can be: 'cpu', 'psu', 'pc', 'fan', 'temperature', 'lnic', 'pnic',...
|
|
|
|
There are some magic words like: 'network', 'storage'.
|
2014-02-02 22:31:38 +01:00
|
|
|
|
2016-12-01 17:12:29 +01:00
|
|
|
=item B<--filter>
|
2013-12-13 16:14:12 +01:00
|
|
|
|
2016-12-01 17:12:29 +01:00
|
|
|
Exclude some parts (comma seperated list) (Example: --filter=fan --filter=temperature)
|
|
|
|
Can also exclude specific instance: --filter=fan,1.2 --filter=lnic,1
|
2014-05-26 22:27:36 +02:00
|
|
|
|
|
|
|
=item B<--absent-problem>
|
|
|
|
|
2016-12-01 17:12:29 +01:00
|
|
|
Return an error if an entity is not 'present' (default is skipping
|
|
|
|
Can be specific or global: --absent-problem=fan,1.2
|
2014-05-26 22:27:36 +02:00
|
|
|
|
|
|
|
=item B<--no-component>
|
|
|
|
|
|
|
|
Return an error if no compenents are checked.
|
|
|
|
If total (with skipped) is 0. (Default: 'critical' returns).
|
2013-12-13 16:14:12 +01:00
|
|
|
|
2015-02-13 16:37:52 +01:00
|
|
|
=item B<--threshold-overload>
|
|
|
|
|
|
|
|
Set to overload default threshold values (syntax: section,status,regexp)
|
|
|
|
It used before default thresholds (order stays).
|
|
|
|
Example: --threshold-overload='temperature,CRITICAL,^(?!(ok)$)'
|
|
|
|
|
|
|
|
=item B<--warning>
|
|
|
|
|
2015-05-07 23:32:16 +02:00
|
|
|
Set warning threshold for temperatures (syntax: type,regexp,threshold)
|
2015-02-13 16:37:52 +01:00
|
|
|
Example: --warning='temperature,.*,30'
|
|
|
|
|
|
|
|
=item B<--critical>
|
|
|
|
|
2015-05-07 23:32:16 +02:00
|
|
|
Set critical threshold for temperatures (syntax: type,regexp,threshold)
|
2015-02-13 16:37:52 +01:00
|
|
|
Example: --critical='temperature,.*,40'
|
|
|
|
|
2013-12-13 16:14:12 +01:00
|
|
|
=back
|
|
|
|
|
2014-05-26 22:27:36 +02:00
|
|
|
=cut
|