diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/cpu.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/cpu.pm index 6a9fe1aac..c258b389b 100644 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/cpu.pm +++ b/centreon-plugins/hardware/server/dell/openmanage/mode/components/cpu.pm @@ -35,6 +35,9 @@ package hardware::server::dell::openmanage::mode::components::cpu; +use strict; +use warnings; + my %status = ( 1 => ['other', 'CRITICAL'], 2 => ['unknown', 'UNKNOWN'], diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/fan.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/fan.pm index 492f71eef..234ea0747 100644 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/fan.pm +++ b/centreon-plugins/hardware/server/dell/openmanage/mode/components/fan.pm @@ -35,6 +35,9 @@ package hardware::server::dell::openmanage::mode::components::fan; +use strict; +use warnings; + my %status = ( 1 => ['other', 'CRITICAL'], 2 => ['unknown', 'UNKNOWN'], diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/globalstatus.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/globalstatus.pm index 257ffc6b6..3c5cfc8f0 100644 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/globalstatus.pm +++ b/centreon-plugins/hardware/server/dell/openmanage/mode/components/globalstatus.pm @@ -35,6 +35,9 @@ package hardware::server::dell::openmanage::mode::components::globalstatus; +use strict; +use warnings; + my %status = ( 1 => ['other', 'CRITICAL'], 2 => ['unknown', 'UNKNOWN'], diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/psu.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/psu.pm index 7002b2895..9e419ba38 100644 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/psu.pm +++ b/centreon-plugins/hardware/server/dell/openmanage/mode/components/psu.pm @@ -35,6 +35,9 @@ package hardware::server::dell::openmanage::mode::components::psu; +use strict; +use warnings; + my %status = ( 1 => ['other', 'CRITICAL'], 2 => ['unknown', 'UNKNOWN'], diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/temperature.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/temperature.pm index 2fd2b888a..4a8b794f3 100644 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/temperature.pm +++ b/centreon-plugins/hardware/server/dell/openmanage/mode/components/temperature.pm @@ -35,6 +35,9 @@ package hardware::server::dell::openmanage::mode::components::temperature; +use strict; +use warnings; + my %status = ( 1 => ['other', 'CRITICAL'], 2 => ['unknown', 'UNKNOWN'], diff --git a/centreon-plugins/hardware/server/hpbladechassis/mode/components/blade.pm b/centreon-plugins/hardware/server/hpbladechassis/mode/components/blade.pm index 8351658f1..10c16bcd5 100644 --- a/centreon-plugins/hardware/server/hpbladechassis/mode/components/blade.pm +++ b/centreon-plugins/hardware/server/hpbladechassis/mode/components/blade.pm @@ -35,6 +35,9 @@ package hardware::server::hpbladechassis::mode::components::blade; +use strict; +use warnings; + my %conditions = ( 1 => ['other', 'CRITICAL'], 2 => ['ok', 'OK'], diff --git a/centreon-plugins/hardware/server/hpbladechassis/mode/components/enclosure.pm b/centreon-plugins/hardware/server/hpbladechassis/mode/components/enclosure.pm index de582c658..4f7eba103 100644 --- a/centreon-plugins/hardware/server/hpbladechassis/mode/components/enclosure.pm +++ b/centreon-plugins/hardware/server/hpbladechassis/mode/components/enclosure.pm @@ -35,6 +35,9 @@ package hardware::server::hpbladechassis::mode::components::enclosure; +use strict; +use warnings; + my %conditions = ( 1 => ['other', 'CRITICAL'], 2 => ['ok', 'OK'], diff --git a/centreon-plugins/hardware/server/hpbladechassis/mode/components/fan.pm b/centreon-plugins/hardware/server/hpbladechassis/mode/components/fan.pm index 1d97e9dcb..cea3571eb 100644 --- a/centreon-plugins/hardware/server/hpbladechassis/mode/components/fan.pm +++ b/centreon-plugins/hardware/server/hpbladechassis/mode/components/fan.pm @@ -35,6 +35,9 @@ package hardware::server::hpbladechassis::mode::components::fan; +use strict; +use warnings; + my %conditions = ( 1 => ['other', 'CRITICAL'], 2 => ['ok', 'OK'], diff --git a/centreon-plugins/hardware/server/hpbladechassis/mode/components/fuse.pm b/centreon-plugins/hardware/server/hpbladechassis/mode/components/fuse.pm index cf0ee48a0..169383296 100644 --- a/centreon-plugins/hardware/server/hpbladechassis/mode/components/fuse.pm +++ b/centreon-plugins/hardware/server/hpbladechassis/mode/components/fuse.pm @@ -35,6 +35,9 @@ package hardware::server::hpbladechassis::mode::components::fuse; +use strict; +use warnings; + my %conditions = ( 1 => ['other', 'CRITICAL'], 2 => ['ok', 'OK'], diff --git a/centreon-plugins/hardware/server/hpbladechassis/mode/components/manager.pm b/centreon-plugins/hardware/server/hpbladechassis/mode/components/manager.pm index 6aabbe94d..5515bd9b1 100644 --- a/centreon-plugins/hardware/server/hpbladechassis/mode/components/manager.pm +++ b/centreon-plugins/hardware/server/hpbladechassis/mode/components/manager.pm @@ -35,6 +35,9 @@ package hardware::server::hpbladechassis::mode::components::manager; +use strict; +use warnings; + my %conditions = ( 1 => ['other', 'CRITICAL'], 2 => ['ok', 'OK'], diff --git a/centreon-plugins/hardware/server/hpbladechassis/mode/components/network.pm b/centreon-plugins/hardware/server/hpbladechassis/mode/components/network.pm index 68a083ddd..49f80c2f8 100644 --- a/centreon-plugins/hardware/server/hpbladechassis/mode/components/network.pm +++ b/centreon-plugins/hardware/server/hpbladechassis/mode/components/network.pm @@ -35,6 +35,9 @@ package hardware::server::hpbladechassis::mode::components::network; +use strict; +use warnings; + my %present_map = ( 1 => 'other', 2 => 'absent', diff --git a/centreon-plugins/hardware/server/hpbladechassis/mode/components/psu.pm b/centreon-plugins/hardware/server/hpbladechassis/mode/components/psu.pm index 7818d687f..3d153b110 100644 --- a/centreon-plugins/hardware/server/hpbladechassis/mode/components/psu.pm +++ b/centreon-plugins/hardware/server/hpbladechassis/mode/components/psu.pm @@ -35,6 +35,9 @@ package hardware::server::hpbladechassis::mode::components::psu; +use strict; +use warnings; + my %conditions = ( 1 => ['other', 'CRITICAL'], 2 => ['ok', 'OK'], diff --git a/centreon-plugins/hardware/server/hpbladechassis/mode/components/temperature.pm b/centreon-plugins/hardware/server/hpbladechassis/mode/components/temperature.pm index 8597bd7a5..87f057608 100644 --- a/centreon-plugins/hardware/server/hpbladechassis/mode/components/temperature.pm +++ b/centreon-plugins/hardware/server/hpbladechassis/mode/components/temperature.pm @@ -35,6 +35,9 @@ package hardware::server::hpbladechassis::mode::components::temperature; +use strict; +use warnings; + my %conditions = ( 1 => ['other', 'CRITICAL'], 2 => ['ok', 'OK'], diff --git a/centreon-plugins/hardware/server/hpproliant/mode/components/cpu.pm b/centreon-plugins/hardware/server/hpproliant/mode/components/cpu.pm index b02f3b41c..3ce002c41 100644 --- a/centreon-plugins/hardware/server/hpproliant/mode/components/cpu.pm +++ b/centreon-plugins/hardware/server/hpproliant/mode/components/cpu.pm @@ -35,6 +35,9 @@ package hardware::server::hpproliant::mode::components::cpu; +use strict; +use warnings; + my %cpustatus = ( 1 => ['unknown', 'UNKNOWN'], 2 => ['ok', 'OK'], diff --git a/centreon-plugins/hardware/server/hpproliant/mode/components/fan.pm b/centreon-plugins/hardware/server/hpproliant/mode/components/fan.pm index 0922cd18e..88b30b24e 100644 --- a/centreon-plugins/hardware/server/hpproliant/mode/components/fan.pm +++ b/centreon-plugins/hardware/server/hpproliant/mode/components/fan.pm @@ -35,6 +35,9 @@ package hardware::server::hpproliant::mode::components::fan; +use strict; +use warnings; + my %conditions = ( 1 => ['other', 'CRITICAL'], 2 => ['ok', 'OK'], diff --git a/centreon-plugins/hardware/server/hpproliant/mode/components/fca.pm b/centreon-plugins/hardware/server/hpproliant/mode/components/fca.pm index a88e09ed0..7d164d1e8 100644 --- a/centreon-plugins/hardware/server/hpproliant/mode/components/fca.pm +++ b/centreon-plugins/hardware/server/hpproliant/mode/components/fca.pm @@ -34,6 +34,10 @@ #################################################################################### package hardware::server::hpproliant::mode::components::fca; + +use strict; +use warnings; + # In 'CPQFCA-MIB.mib' my %conditions = ( diff --git a/centreon-plugins/hardware/server/hpproliant/mode/components/ida.pm b/centreon-plugins/hardware/server/hpproliant/mode/components/ida.pm index 408aeb0d7..231cdea8f 100644 --- a/centreon-plugins/hardware/server/hpproliant/mode/components/ida.pm +++ b/centreon-plugins/hardware/server/hpproliant/mode/components/ida.pm @@ -34,6 +34,10 @@ #################################################################################### package hardware::server::hpproliant::mode::components::ida; + +use strict; +use warnings; + # In 'CPQIDA-MIB.mib' my %model_map = ( diff --git a/centreon-plugins/hardware/server/hpproliant/mode/components/ide.pm b/centreon-plugins/hardware/server/hpproliant/mode/components/ide.pm index 8d4cb0298..87191af13 100644 --- a/centreon-plugins/hardware/server/hpproliant/mode/components/ide.pm +++ b/centreon-plugins/hardware/server/hpproliant/mode/components/ide.pm @@ -35,6 +35,8 @@ package hardware::server::hpproliant::mode::components::ide; +use strict; +use warnings; use centreon::plugins::misc; # In 'CPQIDE-MIB.mib' diff --git a/centreon-plugins/hardware/server/hpproliant/mode/components/network.pm b/centreon-plugins/hardware/server/hpproliant/mode/components/network.pm index 11dd2621c..0d2f6eefa 100644 --- a/centreon-plugins/hardware/server/hpproliant/mode/components/network.pm +++ b/centreon-plugins/hardware/server/hpproliant/mode/components/network.pm @@ -35,6 +35,9 @@ package hardware::server::hpproliant::mode::components::network; +use strict; +use warnings; + my %conditions = ( 1 => ['other', 'CRITICAL'], 2 => ['ok', 'OK'], diff --git a/centreon-plugins/hardware/server/hpproliant/mode/components/pc.pm b/centreon-plugins/hardware/server/hpproliant/mode/components/pc.pm index e5fc92f8f..f12c2d0dc 100644 --- a/centreon-plugins/hardware/server/hpproliant/mode/components/pc.pm +++ b/centreon-plugins/hardware/server/hpproliant/mode/components/pc.pm @@ -35,6 +35,9 @@ package hardware::server::hpproliant::mode::components::pc; +use strict; +use warnings; + my %conditions = ( 1 => ['other', 'CRITICAL'], 2 => ['ok', 'OK'], diff --git a/centreon-plugins/hardware/server/hpproliant/mode/components/psu.pm b/centreon-plugins/hardware/server/hpproliant/mode/components/psu.pm index 885161364..53c57dc64 100644 --- a/centreon-plugins/hardware/server/hpproliant/mode/components/psu.pm +++ b/centreon-plugins/hardware/server/hpproliant/mode/components/psu.pm @@ -35,6 +35,9 @@ package hardware::server::hpproliant::mode::components::psu; +use strict; +use warnings; + my %conditions = ( 1 => ['other', 'CRITICAL'], 2 => ['ok', 'OK'], diff --git a/centreon-plugins/hardware/server/hpproliant/mode/components/sas.pm b/centreon-plugins/hardware/server/hpproliant/mode/components/sas.pm index 455a936cd..4f19f90f0 100644 --- a/centreon-plugins/hardware/server/hpproliant/mode/components/sas.pm +++ b/centreon-plugins/hardware/server/hpproliant/mode/components/sas.pm @@ -35,6 +35,8 @@ package hardware::server::hpproliant::mode::components::sas; +use strict; +use warnings; use centreon::plugins::misc; # In 'CPQSCSI-MIB.mib' diff --git a/centreon-plugins/hardware/server/hpproliant/mode/components/scsi.pm b/centreon-plugins/hardware/server/hpproliant/mode/components/scsi.pm index 94da1c433..0de3be227 100644 --- a/centreon-plugins/hardware/server/hpproliant/mode/components/scsi.pm +++ b/centreon-plugins/hardware/server/hpproliant/mode/components/scsi.pm @@ -36,6 +36,9 @@ package hardware::server::hpproliant::mode::components::scsi; # In 'CPQSCSI-MIB.mib' +use strict; +use warnings; + my %controllerstatus_map = ( 1 => "other", 2 => "ok", diff --git a/centreon-plugins/hardware/server/hpproliant/mode/components/temperature.pm b/centreon-plugins/hardware/server/hpproliant/mode/components/temperature.pm index ab2e1235f..42ddfb676 100644 --- a/centreon-plugins/hardware/server/hpproliant/mode/components/temperature.pm +++ b/centreon-plugins/hardware/server/hpproliant/mode/components/temperature.pm @@ -35,6 +35,9 @@ package hardware::server::hpproliant::mode::components::temperature; +use strict; +use warnings; + my %location_map = ( 1 => "other", 2 => "unknown", diff --git a/centreon-plugins/storage/hp/lefthand/mode/components/device.pm b/centreon-plugins/storage/hp/lefthand/mode/components/device.pm new file mode 100644 index 000000000..898d9b2f0 --- /dev/null +++ b/centreon-plugins/storage/hp/lefthand/mode/components/device.pm @@ -0,0 +1,113 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::hp::lefthand::mode::components::device; + +use strict; +use warnings; + +sub check { + my ($self) = @_; + + $self->{components}->{device} = {name => 'devices', total => 0}; + $self->{output}->output_add(long_msg => "Checking devices"); + return if ($self->check_exclude('device')); + + my $device_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.4.1.0"; + my $device_name_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.14'; + my $device_serie_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.7'; + my $device_present_state_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.90'; + my $device_present_status_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.91'; + my $device_health_state_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.17'; # normal, marginal, faulty + my $device_health_status_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.18'; + my $device_temperature_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.9'; + my $device_temperature_critical_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.10'; + my $device_temperature_limit_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.11'; + my $device_temperature_status_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.12'; + return if ($self->{global_information}->{$device_count_oid} == 0); + + $self->{snmp}->load(oids => [$device_name_oid, $device_serie_oid, + $device_present_state_oid, $device_present_status_oid, + $device_health_state_oid, $device_health_status_oid, + $device_temperature_oid, $device_temperature_critical_oid, + $device_temperature_limit_oid, $device_temperature_status_oid], + begin => 1, end => $self->{global_information}->{$device_count_oid}); + my $result = $self->{snmp}->get_leef(); + return if (scalar(keys %$result) <= 0); + + my $number_device = $self->{global_information}->{$device_count_oid}; + for (my $i = 1; $i <= $number_device; $i++) { + my $device_name = $result->{$device_name_oid . "." . $i}; + my $device_serie = $result->{$device_serie_oid . "." . $i}; + my $device_present_state = $result->{$device_present_state_oid . "." . $i}; + my $device_present_status = $result->{$device_present_status_oid . "." . $i}; + my $device_health_state = $result->{$device_health_state_oid . "." . $i}; + my $device_health_status = $result->{$device_health_status_oid . "." . $i}; + my $device_temperature = $result->{$device_temperature_oid . "." . $i}; + my $device_temperature_critical = $result->{$device_temperature_critical_oid . "." . $i}; + my $device_temperature_limit = $result->{$device_temperature_limit_oid . "." . $i}; + my $device_temperature_status = $result->{$device_temperature_status_oid . "." . $i}; + + $self->{components}->{device}->{total}++; + + $self->{output}->output_add(long_msg => "Storage Device '$device_name' and Serial Number '$device_serie', state = '$device_present_state'"); + # Check if present + if ($device_present_state =~ /off_and_secured|off_or_removed/i) { + next; + } + + # Check global health + if ($device_health_status != 1) { + $self->{output}->output_add(severity => 'CRITICAL', + short_msg => "Storage Device '" . $device_name . "' Smart Health problem '" . $device_health_state . "'"); + } + $self->{output}->output_add(long_msg => " Smart Health status = '" . $device_health_status . "', Smart Health state = '" . $device_health_state . "'"); + + # Check temperature + if ($device_temperature >= $device_temperature_critical) { + $self->{output}->output_add(severity => 'CRITICAL', + short_msg => "Device Storage '" . $device_name . "' temperature too high"); + } elsif ($device_temperature >= $device_temperature_limit) { + $self->{output}->output_add(severity => 'CRITICAL', + short_msg => "Device Storage '" . $device_name . "' over the limit"); + } + $self->{output}->output_add(long_msg => " Temperature value = '" . $device_temperature . "' (limit >= $device_temperature_limit, critical >= $device_temperature_critical)"); + $self->{output}->perfdata_add(label => $device_name . "_temp", + value => $device_temperature, + warning => $device_temperature_limit, critical => $device_temperature_critical); + } +} + +1; \ No newline at end of file diff --git a/centreon-plugins/storage/hp/lefthand/mode/components/fan.pm b/centreon-plugins/storage/hp/lefthand/mode/components/fan.pm new file mode 100644 index 000000000..82cf5e50c --- /dev/null +++ b/centreon-plugins/storage/hp/lefthand/mode/components/fan.pm @@ -0,0 +1,96 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::hp::lefthand::mode::components::fan; + +use strict; +use warnings; + +sub check { + my ($self) = @_; + + $self->{components}->{fan} = {name => 'fans', total => 0}; + $self->{output}->output_add(long_msg => "Checking fan"); + return if ($self->check_exclude('fan')); + + my $fan_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.110.0"; # 0 means 'none' + my $fan_name_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.111.1.2"; # begin .1 + my $fan_speed_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.111.1.3"; # dont have + my $fan_min_speed_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.111.1.4"; # dont have + my $fan_state_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.111.1.90"; # string explained + my $fan_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.111.1.91"; + return if ($self->{global_information}->{$fan_count_oid} == 0); + + $self->{snmp}->load(oids => [$fan_name_oid, $fan_name_oid, + $fan_min_speed_oid, $fan_state_oid, $fan_status_oid], + begin => 1, end => $self->{global_information}->{$fan_count_oid}); + my $result = $self->{snmp}->get_leef(); + return if (scalar(keys %$result) <= 0); + + my $number_fans = $self->{global_information}->{$fan_count_oid}; + for (my $i = 1; $i <= $number_fans; $i++) { + my $fan_name = $result->{$fan_name_oid . "." . $i}; + my $fan_speed = $result->{$fan_speed_oid . "." . $i}; + my $fan_min_speed = $result->{$fan_min_speed_oid . "." . $i}; + my $fan_status = $result->{$fan_status_oid . "." . $i}; + my $fan_state = $result->{$fan_state_oid . "." . $i}; + + $self->{components}->{fan}->{total}++; + + # Check Fan Speed + if (defined($fan_speed)) { + my $low_limit = ''; + if (defined($fan_min_speed)) { + $low_limit = '@:' . $fan_min_speed; + if ($fan_speed <= $fan_min_speed) { + $self->{output}->output_add(severity => 'CRITICAL', + short_msg => "Fan '" . $fan_name . "' speed too low"); + } + } + $self->{output}->output_add(long_msg => "Fan '" . $fan_name . "' speed = '" . $fan_speed . "' (<= $fan_min_speed)"); + $self->{output}->perfdata_add(label => $fan_name, unit => 'rpm', + value => $fan_speed, + critical => $low_limit); + } + + if ($fan_status != 1) { + $self->{output}->output_add(severity => 'CRITICAL', + short_msg => "Fan '" . $fan_name . "' problem '" . $fan_state . "'"); + } + $self->{output}->output_add(long_msg => "Fan '" . $fan_name . "' status = '" . $fan_status . "', state = '" . $fan_state . "'"); + } +} + +1; \ No newline at end of file diff --git a/centreon-plugins/storage/hp/lefthand/mode/components/psu.pm b/centreon-plugins/storage/hp/lefthand/mode/components/psu.pm new file mode 100644 index 000000000..28e7fed05 --- /dev/null +++ b/centreon-plugins/storage/hp/lefthand/mode/components/psu.pm @@ -0,0 +1,76 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::hp::lefthand::mode::components::psu; + +use strict; +use warnings; + +sub check { + my ($self) = @_; + + $self->{components}->{psu} = {name => 'power supplies', total => 0}; + $self->{output}->output_add(long_msg => "Checking power supplies"); + return if ($self->check_exclude('psu')); + + my $power_supply_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.130.0"; + my $power_supply_name_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.131.1.2"; + my $power_supply_state_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.131.1.90"; + my $power_supply_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.131.1.91"; + return if ($self->{global_information}->{$power_supply_count_oid} == 0); + + $self->{snmp}->load(oids => [$power_supply_name_oid, $power_supply_name_oid, + $power_supply_status_oid], + begin => 1, end => $self->{global_information}->{$power_supply_count_oid}); + my $result = $self->{snmp}->get_leef(); + return if (scalar(keys %$result) <= 0); + + my $number_ps = $self->{global_information}->{$power_supply_count_oid}; + for (my $i = 1; $i <= $number_ps; $i++) { + my $ps_name = $result->{$power_supply_name_oid . "." . $i}; + my $ps_state = $result->{$power_supply_state_oid . "." . $i}; + my $ps_status = $result->{$power_supply_status_oid . "." . $i}; + + $self->{components}->{psu}->{total}++; + + if ($ps_status != 1) { + $self->{output}->output_add(severity => 'CRITICAL', + short_msg => "Power Supply '" . $ps_name . "' problem '" . $ps_state . "'"); + } + $self->{output}->output_add(long_msg => "Power Supply '" . $ps_name . "' status = '" . $ps_status . "', state = '" . $ps_state . "'"); + } +} + +1; \ No newline at end of file diff --git a/centreon-plugins/storage/hp/lefthand/mode/components/rc.pm b/centreon-plugins/storage/hp/lefthand/mode/components/rc.pm new file mode 100644 index 000000000..949246799 --- /dev/null +++ b/centreon-plugins/storage/hp/lefthand/mode/components/rc.pm @@ -0,0 +1,76 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::hp::lefthand::mode::components::rc; + +use strict; +use warnings; + +sub check { + my ($self) = @_; + + $self->{components}->{rc} = {name => 'raid controllers', total => 0}; + $self->{output}->output_add(long_msg => "Checking raid controllers"); + return if ($self->check_exclude('rc')); + + my $rc_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.4.3.0"; + my $rc_name_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.4.1.2'; + my $rc_state_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.4.1.90'; + my $rc_status_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.4.1.91'; + return if ($self->{global_information}->{$rc_count_oid} == 0); + + $self->{snmp}->load(oids => [$rc_name_oid, $rc_state_oid, + $rc_status_oid], + begin => 1, end => $self->{global_information}->{$rc_count_oid}); + my $result = $self->{snmp}->get_leef(); + return if (scalar(keys %$result) <= 0); + + my $number_rc = $self->{global_information}->{$rc_count_oid}; + for (my $i = 1; $i <= $number_rc; $i++) { + my $rc_name = $result->{$rc_name_oid . "." . $i}; + my $rc_state = $result->{$rc_state_oid . "." . $i}; + my $rc_status = $result->{$rc_status_oid . "." . $i}; + + $self->{components}->{rc}->{total}++; + + if ($rc_status != 1) { + $self->{output}->output_add(severity => 'CRITICAL', + short_msg => "Raid Device (Controller) '" . $rc_name . "' problem '" . $rc_state . "'"); + } + $self->{output}->output_add(long_msg => "Raid Device (Controller) '" . $rc_name . "' status = '" . $rc_status . "', state = '" . $rc_state . "'"); + } +} + +1; \ No newline at end of file diff --git a/centreon-plugins/storage/hp/lefthand/mode/components/rcc.pm b/centreon-plugins/storage/hp/lefthand/mode/components/rcc.pm new file mode 100644 index 000000000..3cee28c64 --- /dev/null +++ b/centreon-plugins/storage/hp/lefthand/mode/components/rcc.pm @@ -0,0 +1,91 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::hp::lefthand::mode::components::rcc; + +use strict; +use warnings; + +sub check { + my ($self) = @_; + + $self->{components}->{rcc} = {name => 'raid controller caches', total => 0}; + $self->{output}->output_add(long_msg => "Checking raid controller cache"); + return if ($self->check_exclude('rcc')); + + my $rcc_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.90.0"; + my $rcc_name_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.91.1.2"; # begin .1 + my $rcc_state_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.91.1.90"; + my $rcc_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.91.1.91"; + my $bbu_enabled_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.91.1.50"; # 1 mean 'enabled' + my $bbu_state_oid = '.1.3.6.1.4.1.9804.3.1.1.2.1.91.1.22'; + my $bbu_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.91.1.23"; # 1 mean 'ok' + return if ($self->{global_information}->{$rcc_count_oid} == 0); + + $self->{snmp}->load(oids => [$rcc_name_oid, $rcc_state_oid, + $rcc_status_oid, $bbu_enabled_oid, $bbu_state_oid, $bbu_status_oid], + begin => 1, end => $self->{global_information}->{$rcc_count_oid}); + my $result = $self->{snmp}->get_leef(); + return if (scalar(keys %$result) <= 0); + + my $number_raid = $self->{global_information}->{$rcc_count_oid}; + for (my $i = 1; $i <= $number_raid; $i++) { + my $raid_name = $result->{$rcc_name_oid . "." . $i}; + my $raid_state = $result->{$rcc_state_oid . "." . $i}; + my $raid_status = $result->{$rcc_status_oid . "." . $i}; + my $bbu_enabled = $result->{$bbu_enabled_oid . "." . $i}; + my $bbu_state = $result->{$bbu_state_oid . "." . $i}; + my $bbu_status = $result->{$bbu_status_oid . "." . $i}; + + $self->{components}->{rcc}->{total}++; + + if ($raid_status != 1) { + $self->{output}->output_add(severity => 'CRITICAL', + short_msg => "Raid Controller Caches '" . $raid_name . "' problem '" . $raid_state . "'"); + } + $self->{output}->output_add(long_msg => "Raid Controller Caches '" . $raid_name . "' status = '" . $raid_status . "', state = '" . $raid_state . "'"); + if ($bbu_enabled == 1) { + if ($bbu_status != 1) { + $self->{output}->output_add(severity => 'CRITICAL', + short_msg => "BBU '" . $raid_name . "' problem '" . $bbu_state . "'"); + } + $self->{output}->output_add(long_msg => " BBU status = '" . $bbu_status . "', state = '" . $bbu_state . "'"); + } else { + $self->{output}->output_add(long_msg => " BBU disabled"); + } + } +} + +1; \ No newline at end of file diff --git a/centreon-plugins/storage/hp/lefthand/mode/components/ro.pm b/centreon-plugins/storage/hp/lefthand/mode/components/ro.pm new file mode 100644 index 000000000..acb6ab2bb --- /dev/null +++ b/centreon-plugins/storage/hp/lefthand/mode/components/ro.pm @@ -0,0 +1,73 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::hp::lefthand::mode::components::ro; + +use strict; +use warnings; + +sub check { + my ($self) = @_; + + $self->{components}->{ro} = {name => 'raid os devices', total => 0}; + $self->{output}->output_add(long_msg => "Checking raid os devices"); + return if ($self->check_exclude('ro')); + + my $raid_os_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.4.50.0"; + my $raid_os_name_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.51.1.2'; + my $raid_os_state_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.51.1.90'; # != 'normal' + return if ($self->{global_information}->{$raid_os_count_oid} == 0); + + $self->{snmp}->load(oids => [$raid_os_name_oid, $raid_os_state_oid], + begin => 1, end => $self->{global_information}->{$raid_os_count_oid}); + my $result = $self->{snmp}->get_leef(); + return if (scalar(keys %$result) <= 0); + + my $number_ro = $self->{global_information}->{$raid_os_count_oid}; + for (my $i = 1; $i <= $number_ro; $i++) { + my $ro_name = $arg_result->{values}->{$raid_os_name_oid . "." . $i}; + my $ro_state = $arg_result->{values}->{$raid_os_state_oid . "." . $i}; + + $self->{components}->{ro}->{total}++; + + if ($ro_state !~ /normal/i) { + $self->{output}->output_add(severity => 'CRITICAL', + short_msg => "Raid OS Device '" . $ro_name . "' problem '" . $ro_state . "'"); + } + $self->{output}->output_add(long_msg => "Raid OS Device '" . $ro_name . "' state = '" . $ro_state . "'"); + } +} + +1; \ No newline at end of file diff --git a/centreon-plugins/storage/hp/lefthand/mode/components/temperature.pm b/centreon-plugins/storage/hp/lefthand/mode/components/temperature.pm new file mode 100644 index 000000000..a07670d90 --- /dev/null +++ b/centreon-plugins/storage/hp/lefthand/mode/components/temperature.pm @@ -0,0 +1,94 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::hp::lefthand::mode::components::temperature; + +use strict; +use warnings; + +sub check { + my ($self) = @_; + + $self->{components}->{temperature} = {name => 'temperature sensors', total => 0}; + $self->{output}->output_add(long_msg => "Checking temperature sensors"); + return if ($self->check_exclude('temperature')); + + my $temperature_sensor_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.120.0"; + my $temperature_sensor_name_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.2"; + my $temperature_sensor_value_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.3"; + my $temperature_sensor_critical_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.4"; + my $temperature_sensor_limit_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.5"; # warning. lower than critical + my $temperature_sensor_state_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.90"; + my $temperature_sensor_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.91"; + return if ($self->{global_information}->{$temperature_sensor_count_oid} == 0); + + $self->{snmp}->load(oids => [$temperature_sensor_name_oid, $temperature_sensor_value_oid, + $temperature_sensor_critical_oid, $temperature_sensor_limit_oid, $temperature_sensor_state_oid, $temperature_sensor_status_oid], + begin => 1, end => $self->{global_information}->{$temperature_sensor_count_oid}); + my $result = $self->{snmp}->get_leef(); + return if (scalar(keys %$result) <= 0); + + my $number_temperature = $self->{global_information}->{$temperature_sensor_count_oid}; + for (my $i = 1; $i <= $number_temperature; $i++) { + my $ts_name = $result->{$temperature_sensor_name_oid . "." . $i}; + my $ts_value = $result->{$temperature_sensor_value_oid . "." . $i}; + my $ts_critical = $result->{$temperature_sensor_critical_oid . "." . $i}; + my $ts_limit = $result->{$temperature_sensor_limit_oid . "." . $i}; + my $ts_state = $result->{$temperature_sensor_state_oid . "." . $i}; + my $ts_status = $result->{$temperature_sensor_status_oid . "." . $i}; + + $self->{components}->{temperature}->{total}++; + + if ($ts_value >= $ts_critical) { + $self->{output}->output_add(severity => 'CRITICAL', + short_msg => "Temperature sensor '" . $ts_name . "' too high"); + } elsif ($ts_value >= $ts_limit) { + $self->{output}->output_add(severity => 'CRITICAL', + short_msg => "Temperature sensor '" . $ts_name . "' over the limit"); + } + $self->{output}->output_add(long_msg => "Temperature sensor '" . $ts_name . "' value = '" . $ts_value . "' (limit >= $ts_limit, critical >= $ts_critical)"); + $self->{output}->perfdata_add(label => $ts_name . "_temp", + value => $ts_value, + warning => $ts_limit, critical => $ts_critical); + + if ($ts_status != 1) { + $self->{output}->output_add(severity => 'CRITICAL', + short_msg => "Temperature sensor '" . $ts_name . "' problem '" . $ts_state . "'"); + } + $self->{output}->output_add(long_msg => "Temperature sensor '" . $ts_name . "' status = '" . $ts_status . "', state = '" . $ts_state . "'"); + } +} + +1; \ No newline at end of file diff --git a/centreon-plugins/storage/hp/lefthand/mode/components/voltage.pm b/centreon-plugins/storage/hp/lefthand/mode/components/voltage.pm new file mode 100644 index 000000000..71397e683 --- /dev/null +++ b/centreon-plugins/storage/hp/lefthand/mode/components/voltage.pm @@ -0,0 +1,98 @@ +################################################################################ +# Copyright 2005-2013 MERETHIS +# Centreon is developped by : Julien Mathis and Romain Le Merlus under +# GPL Licence 2.0. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation ; either version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Linking this program statically or dynamically with other modules is making a +# combined work based on this program. Thus, the terms and conditions of the GNU +# General Public License cover the whole combination. +# +# As a special exception, the copyright holders of this program give MERETHIS +# permission to link this program with independent modules to produce an executable, +# regardless of the license terms of these independent modules, and to copy and +# distribute the resulting executable under terms of MERETHIS choice, provided that +# MERETHIS also meet, for each linked independent module, the terms and conditions +# of the license of that module. An independent module is a module which is not +# derived from this program. If you modify this program, you may extend this +# exception to your version of the program, but you are not obliged to do so. If you +# do not wish to do so, delete this exception statement from your version. +# +# For more information : contact@centreon.com +# Authors : Quentin Garnier +# +#################################################################################### + +package storage::hp::lefthand::mode::components::voltage; + +use strict; +use warnings; + +sub check { + my ($self) = @_; + + $self->{components}->{voltage} = {name => 'voltage sensors', total => 0}; + $self->{output}->output_add(long_msg => "Checking voltage sensors"); + return if ($self->check_exclude('voltage')); + + my $vs_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.140.0"; + my $vs_name_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.2"; + my $vs_value_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.3"; + my $vs_low_limit_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.4"; + my $vs_high_limit_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.5"; + my $vs_state_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.90"; + my $vs_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.91"; + return if ($self->{global_information}->{$vs_count_oid} == 0); + + $self->{snmp}->load(oids => [$vs_name_oid, $vs_value_oid, + $vs_low_limit_oid, $vs_high_limit_oid, + $vs_state_oid, $vs_status_oid], + begin => 1, end => $self->{global_information}->{$vs_count_oid}); + my $result = $self->{snmp}->get_leef(); + return if (scalar(keys %$result) <= 0); + + my $number_vs = $self->{global_information}->{$vs_count_oid}; + for (my $i = 1; $i <= $number_vs; $i++) { + my $vs_name = $result->{$vs_name_oid . "." . $i}; + my $vs_value = $result->{$vs_value_oid . "." . $i}; + my $vs_low_limit = $result->{$vs_low_limit_oid . "." . $i}; + my $vs_high_limit = $result->{$vs_high_limit_oid . "." . $i}; + my $vs_state = $result->{$vs_state_oid . "." . $i}; + my $vs_status = $result->{$vs_status_oid . "." . $i}; + + $self->{components}->{voltage}->{total}++; + + # Check Voltage limit + if (defined($vs_low_limit) && defined($vs_high_limit)) { + if ($vs_value <= $vs_low_limit) { + $self->{output}->output_add(severity => 'CRITICAL', + short_msg => "Voltage sensor '" . $vs_name . "' too low"); + } elsif ($vs_value >= $vs_high_limit) { + $self->{output}->output_add(severity => 'CRITICAL', + short_msg => "Voltage sensor '" . $vs_name . "' too high"); + } + $self->{output}->output_add(long_msg => "Voltage sensor '" . $vs_name . "' value = '" . $vs_value . "' (<= $vs_low_limit, >= $vs_high_limit)"); + $self->{output}->perfdata_add(label => $vs_name . "_volt", + value => $vs_value, + warning => '@:' . $vs_low_limit, critical => $vs_high_limit); + } + + if ($vs_status != 1) { + $self->{output}->output_add(severity => 'CRITICAL', + short_msg => "Voltage sensor '" . $vs_name . "' problem '" . $vs_state . "'"); + } + $self->{output}->output_add(long_msg => "Voltage sensor '" . $vs_name . "' status = '" . $vs_status . "', state = '" . $vs_state . "'"); + } +} + +1; \ No newline at end of file diff --git a/centreon-plugins/storage/hp/lefthand/mode/hardware.pm b/centreon-plugins/storage/hp/lefthand/mode/hardware.pm index fcf99c60b..9f539e836 100644 --- a/centreon-plugins/storage/hp/lefthand/mode/hardware.pm +++ b/centreon-plugins/storage/hp/lefthand/mode/hardware.pm @@ -39,7 +39,14 @@ use base qw(centreon::plugins::mode); use strict; use warnings; -use centreon::plugins::misc; +use storage::hp::lefthand::mode::components::fan; +use storage::hp::lefthand::mode::components::rcc; +use storage::hp::lefthand::mode::components::temperature; +use storage::hp::lefthand::mode::components::psu; +use storage::hp::lefthand::mode::components::voltage; +use storage::hp::lefthand::mode::components::device; +use storage::hp::lefthand::mode::components::rc; +use storage::hp::lefthand::mode::components::ro; sub new { my ($class, %options) = @_; @@ -50,11 +57,9 @@ sub new { $options{options}->add_options(arguments => { "exclude:s" => { name => 'exclude' }, + "component:s" => { name => 'component', default => 'all' }, }); - - $self->{product_name} = undef; - $self->{serial} = undef; - $self->{romversion} = undef; + $self->{components} = {}; return $self; } @@ -63,34 +68,74 @@ sub check_options { $self->SUPER::init(%options); } +sub global { + my ($self, %options) = @_; + + storage::hp::lefthand::mode::components::fan::check($self); + storage::hp::lefthand::mode::components::rcc::check($self); + storage::hp::lefthand::mode::components::temperature::check($self); + storage::hp::lefthand::mode::components::psu::check($self); + storage::hp::lefthand::mode::components::voltage::check($self); + storage::hp::lefthand::mode::components::device::check($self); + storage::hp::lefthand::mode::components::rc::check($self); + storage::hp::lefthand::mode::components::ro::check($self); +} + +sub component { + my ($self, %options) = @_; + + if ($self->{option_results}->{component} eq 'fan') { + storage::hp::lefthand::mode::components::fan::check($self); + } elsif ($self->{option_results}->{component} eq 'rcc') { + storage::hp::lefthand::mode::components::rcc::check($self); + } elsif ($self->{option_results}->{component} eq 'temperature') { + storage::hp::lefthand::mode::components::temperature::check($self); + } elsif ($self->{option_results}->{component} eq 'psu') { + storage::hp::lefthand::mode::components::psu::check($self); + } elsif ($self->{option_results}->{component} eq 'voltage') { + storage::hp::lefthand::mode::components::voltage::check($self); + } elsif ($self->{option_results}->{component} eq 'device') { + storage::hp::lefthand::mode::components::device::check($self); + } elsif ($self->{option_results}->{component} eq 'rc') { + storage::hp::lefthand::mode::components::rc::check($self); + } elsif ($self->{option_results}->{component} eq 'ro') { + storage::hp::lefthand::mode::components::ro::check($self); + } else { + $self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'."); + $self->{output}->option_exit(); + } +} + sub run { my ($self, %options) = @_; # $options{snmp} = snmp object $self->{snmp} = $options{snmp}; - $self->{components_fan} = 0; - $self->{components_rcc} = 0; - $self->{components_temperature} = 0; - $self->{components_psu} = 0; - $self->{components_voltage} = 0; - $self->{components_device} = 0; - $self->{components_rc} = 0; - $self->{components_ro} = 0; - $self->get_global_information(); - $self->check_fan(); - $self->check_rcc(); - $self->check_temperature(); - $self->check_psu(); - $self->check_voltage(); - $self->check_device(); - $self->check_rc(); - $self->check_ro(); + + if ($self->{option_results}->{component} eq 'all') { + $self->global(); + } else { + $self->component(); + } + + my $total_components = 0; + my $display_by_component = ''; + my $display_by_component_append = ''; + foreach my $comp (sort(keys %{$self->{components}})) { + # Skipping short msg when no components + next if ($self->{components}->{$comp}->{total} == 0); + $total_components += $self->{components}->{$comp}->{total}; + $display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . ' ' . $self->{components}->{$comp}->{name}; + $display_by_component_append = ', '; + } $self->{output}->output_add(severity => 'OK', - short_msg => sprintf("All %d components [%d fans, %d power supplies, %d temperatures, %d voltages, %d raid controller caches, %d devices, %d raid controllers, %d raid os] are ok.", - ($self->{components_fan} + $self->{components_rcc} + $self->{components_temperature} + $self->{components_psu} + $self->{components_voltage} + $self->{components_device} + $self->{components_rc} + $self->{components_ro}), - $self->{components_fan}, $self->{components_psu}, $self->{components_temperature}, $self->{components_voltage}, $self->{components_rcc}, $self->{components_device}, $self->{components_rc}, $self->{components_ro})); + short_msg => sprintf("All %s components [%s] are ok.", + $total_components, + $display_by_component + ) + ); $self->{output}->display(); $self->{output}->exit(); @@ -111,387 +156,6 @@ sub get_global_information { ], nothing_quit => 1); } -sub check_fan { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking fan"); - return if ($self->check_exclude('fan')); - - my $fan_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.110.0"; # 0 means 'none' - my $fan_name_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.111.1.2"; # begin .1 - my $fan_speed_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.111.1.3"; # dont have - my $fan_min_speed_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.111.1.4"; # dont have - my $fan_state_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.111.1.90"; # string explained - my $fan_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.111.1.91"; - return if ($self->{global_information}->{$fan_count_oid} == 0); - - $self->{snmp}->load(oids => [$fan_name_oid, $fan_name_oid, - $fan_min_speed_oid, $fan_state_oid, $fan_status_oid], - begin => 1, end => $self->{global_information}->{$fan_count_oid}); - my $result = $self->{snmp}->get_leef(); - return if (scalar(keys %$result) <= 0); - - my $number_fans = $self->{global_information}->{$fan_count_oid}; - for (my $i = 1; $i <= $number_fans; $i++) { - my $fan_name = $result->{$fan_name_oid . "." . $i}; - my $fan_speed = $result->{$fan_speed_oid . "." . $i}; - my $fan_min_speed = $result->{$fan_min_speed_oid . "." . $i}; - my $fan_status = $result->{$fan_status_oid . "." . $i}; - my $fan_state = $result->{$fan_state_oid . "." . $i}; - - $self->{components_fan}++; - - # Check Fan Speed - if (defined($fan_speed)) { - my $low_limit = ''; - if (defined($fan_min_speed)) { - $low_limit = '@:' . $fan_min_speed; - if ($fan_speed <= $fan_min_speed) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "Fan '" . $fan_name . "' speed too low"); - } - } - $self->{output}->output_add(long_msg => "Fan '" . $fan_name . "' speed = '" . $fan_speed . "' (<= $fan_min_speed)"); - $self->{output}->perfdata_add(label => $fan_name, unit => 'rpm', - value => $fan_speed, - critical => $low_limit); - } - - if ($fan_status != 1) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "Fan '" . $fan_name . "' problem '" . $fan_state . "'"); - } - $self->{output}->output_add(long_msg => "Fan '" . $fan_name . "' status = '" . $fan_status . "', state = '" . $fan_state . "'"); - } -} - -sub check_rcc { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking raid controller cache"); - return if ($self->check_exclude('rcc')); - - my $rcc_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.90.0"; - my $rcc_name_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.91.1.2"; # begin .1 - my $rcc_state_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.91.1.90"; - my $rcc_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.91.1.91"; - my $bbu_enabled_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.91.1.50"; # 1 mean 'enabled' - my $bbu_state_oid = '.1.3.6.1.4.1.9804.3.1.1.2.1.91.1.22'; - my $bbu_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.91.1.23"; # 1 mean 'ok' - return if ($self->{global_information}->{$rcc_count_oid} == 0); - - $self->{snmp}->load(oids => [$rcc_name_oid, $rcc_state_oid, - $rcc_status_oid, $bbu_enabled_oid, $bbu_state_oid, $bbu_status_oid], - begin => 1, end => $self->{global_information}->{$rcc_count_oid}); - my $result = $self->{snmp}->get_leef(); - return if (scalar(keys %$result) <= 0); - - my $number_raid = $self->{global_information}->{$rcc_count_oid}; - for (my $i = 1; $i <= $number_raid; $i++) { - my $raid_name = $result->{$rcc_name_oid . "." . $i}; - my $raid_state = $result->{$rcc_state_oid . "." . $i}; - my $raid_status = $result->{$rcc_status_oid . "." . $i}; - my $bbu_enabled = $result->{$bbu_enabled_oid . "." . $i}; - my $bbu_state = $result->{$bbu_state_oid . "." . $i}; - my $bbu_status = $result->{$bbu_status_oid . "." . $i}; - - $self->{components_rcc}++; - - if ($raid_status != 1) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "Raid Controller Caches '" . $raid_name . "' problem '" . $raid_state . "'"); - } - $self->{output}->output_add(long_msg => "Raid Controller Caches '" . $raid_name . "' status = '" . $raid_status . "', state = '" . $raid_state . "'"); - if ($bbu_enabled == 1) { - if ($bbu_status != 1) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "BBU '" . $raid_name . "' problem '" . $bbu_state . "'"); - } - $self->{output}->output_add(long_msg => " BBU status = '" . $bbu_status . "', state = '" . $bbu_state . "'"); - } else { - $self->{output}->output_add(long_msg => " BBU disabled"); - } - } -} - -sub check_temperature { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking temperature sensors"); - return if ($self->check_exclude('temperature')); - - my $temperature_sensor_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.120.0"; - my $temperature_sensor_name_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.2"; - my $temperature_sensor_value_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.3"; - my $temperature_sensor_critical_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.4"; - my $temperature_sensor_limit_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.5"; # warning. lower than critical - my $temperature_sensor_state_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.90"; - my $temperature_sensor_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.121.1.91"; - return if ($self->{global_information}->{$temperature_sensor_count_oid} == 0); - - $self->{snmp}->load(oids => [$temperature_sensor_name_oid, $temperature_sensor_value_oid, - $temperature_sensor_critical_oid, $temperature_sensor_limit_oid, $temperature_sensor_state_oid, $temperature_sensor_status_oid], - begin => 1, end => $self->{global_information}->{$temperature_sensor_count_oid}); - my $result = $self->{snmp}->get_leef(); - return if (scalar(keys %$result) <= 0); - - my $number_temperature = $self->{global_information}->{$temperature_sensor_count_oid}; - for (my $i = 1; $i <= $number_temperature; $i++) { - my $ts_name = $result->{$temperature_sensor_name_oid . "." . $i}; - my $ts_value = $result->{$temperature_sensor_value_oid . "." . $i}; - my $ts_critical = $result->{$temperature_sensor_critical_oid . "." . $i}; - my $ts_limit = $result->{$temperature_sensor_limit_oid . "." . $i}; - my $ts_state = $result->{$temperature_sensor_state_oid . "." . $i}; - my $ts_status = $result->{$temperature_sensor_status_oid . "." . $i}; - - $self->{components_temperature}++; - - if ($ts_value >= $ts_critical) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "Temperature sensor '" . $ts_name . "' too high"); - } elsif ($ts_value >= $ts_limit) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "Temperature sensor '" . $ts_name . "' over the limit"); - } - $self->{output}->output_add(long_msg => "Temperature sensor '" . $ts_name . "' value = '" . $ts_value . "' (limit >= $ts_limit, critical >= $ts_critical)"); - $self->{output}->perfdata_add(label => $ts_name . "_temp", - value => $ts_value, - warning => $ts_limit, critical => $ts_critical); - - if ($ts_status != 1) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "Temperature sensor '" . $ts_name . "' problem '" . $ts_state . "'"); - } - $self->{output}->output_add(long_msg => "Temperature sensor '" . $ts_name . "' status = '" . $ts_status . "', state = '" . $ts_state . "'"); - } -} - -sub check_psu { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking power supplies"); - return if ($self->check_exclude('psu')); - - my $power_supply_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.130.0"; - my $power_supply_name_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.131.1.2"; - my $power_supply_state_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.131.1.90"; - my $power_supply_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.131.1.91"; - return if ($self->{global_information}->{$power_supply_count_oid} == 0); - - $self->{snmp}->load(oids => [$power_supply_name_oid, $power_supply_name_oid, - $power_supply_status_oid], - begin => 1, end => $self->{global_information}->{$power_supply_count_oid}); - my $result = $self->{snmp}->get_leef(); - return if (scalar(keys %$result) <= 0); - - my $number_ps = $self->{global_information}->{$power_supply_count_oid}; - for (my $i = 1; $i <= $number_ps; $i++) { - my $ps_name = $result->{$power_supply_name_oid . "." . $i}; - my $ps_state = $result->{$power_supply_state_oid . "." . $i}; - my $ps_status = $result->{$power_supply_status_oid . "." . $i}; - - $self->{components_psu}++; - - if ($ps_status != 1) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "Power Supply '" . $ps_name . "' problem '" . $ps_state . "'"); - } - $self->{output}->output_add(long_msg => "Power Supply '" . $ps_name . "' status = '" . $ps_status . "', state = '" . $ps_state . "'"); - } -} - -sub check_voltage { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking voltage sensors"); - return if ($self->check_exclude('voltage')); - - my $vs_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.140.0"; - my $vs_name_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.2"; - my $vs_value_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.3"; - my $vs_low_limit_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.4"; - my $vs_high_limit_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.5"; - my $vs_state_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.90"; - my $vs_status_oid = ".1.3.6.1.4.1.9804.3.1.1.2.1.141.1.91"; - return if ($self->{global_information}->{$vs_count_oid} == 0); - - $self->{snmp}->load(oids => [$vs_name_oid, $vs_value_oid, - $vs_low_limit_oid, $vs_high_limit_oid, - $vs_state_oid, $vs_status_oid], - begin => 1, end => $self->{global_information}->{$vs_count_oid}); - my $result = $self->{snmp}->get_leef(); - return if (scalar(keys %$result) <= 0); - - my $number_vs = $self->{global_information}->{$vs_count_oid}; - for (my $i = 1; $i <= $number_vs; $i++) { - my $vs_name = $result->{$vs_name_oid . "." . $i}; - my $vs_value = $result->{$vs_value_oid . "." . $i}; - my $vs_low_limit = $result->{$vs_low_limit_oid . "." . $i}; - my $vs_high_limit = $result->{$vs_high_limit_oid . "." . $i}; - my $vs_state = $result->{$vs_state_oid . "." . $i}; - my $vs_status = $result->{$vs_status_oid . "." . $i}; - - $self->{components_voltage}++; - - # Check Voltage limit - if (defined($vs_low_limit) && defined($vs_high_limit)) { - if ($vs_value <= $vs_low_limit) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "Voltage sensor '" . $vs_name . "' too low"); - } elsif ($vs_value >= $vs_high_limit) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "Voltage sensor '" . $vs_name . "' too high"); - } - $self->{output}->output_add(long_msg => "Voltage sensor '" . $vs_name . "' value = '" . $vs_value . "' (<= $vs_low_limit, >= $vs_high_limit)"); - $self->{output}->perfdata_add(label => $vs_name . "_volt", - value => $vs_value, - warning => '@:' . $vs_low_limit, critical => $vs_high_limit); - } - - if ($vs_status != 1) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "Voltage sensor '" . $vs_name . "' problem '" . $vs_state . "'"); - } - $self->{output}->output_add(long_msg => "Voltage sensor '" . $vs_name . "' status = '" . $vs_status . "', state = '" . $vs_state . "'"); - } -} - -sub check_device { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking devices"); - return if ($self->check_exclude('device')); - - my $device_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.4.1.0"; - my $device_name_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.14'; - my $device_serie_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.7'; - my $device_present_state_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.90'; - my $device_present_status_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.91'; - my $device_health_state_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.17'; # normal, marginal, faulty - my $device_health_status_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.18'; - my $device_temperature_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.9'; - my $device_temperature_critical_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.10'; - my $device_temperature_limit_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.11'; - my $device_temperature_status_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.2.1.12'; - return if ($self->{global_information}->{$device_count_oid} == 0); - - $self->{snmp}->load(oids => [$device_name_oid, $device_serie_oid, - $device_present_state_oid, $device_present_status_oid, - $device_health_state_oid, $device_health_status_oid, - $device_temperature_oid, $device_temperature_critical_oid, - $device_temperature_limit_oid, $device_temperature_status_oid], - begin => 1, end => $self->{global_information}->{$device_count_oid}); - my $result = $self->{snmp}->get_leef(); - return if (scalar(keys %$result) <= 0); - - my $number_device = $self->{global_information}->{$device_count_oid}; - for (my $i = 1; $i <= $number_device; $i++) { - my $device_name = $result->{$device_name_oid . "." . $i}; - my $device_serie = $result->{$device_serie_oid . "." . $i}; - my $device_present_state = $result->{$device_present_state_oid . "." . $i}; - my $device_present_status = $result->{$device_present_status_oid . "." . $i}; - my $device_health_state = $result->{$device_health_state_oid . "." . $i}; - my $device_health_status = $result->{$device_health_status_oid . "." . $i}; - my $device_temperature = $result->{$device_temperature_oid . "." . $i}; - my $device_temperature_critical = $result->{$device_temperature_critical_oid . "." . $i}; - my $device_temperature_limit = $result->{$device_temperature_limit_oid . "." . $i}; - my $device_temperature_status = $result->{$device_temperature_status_oid . "." . $i}; - - $self->{components_device}++; - - $self->{output}->output_add(long_msg => "Storage Device '$device_name' and Serial Number '$device_serie', state = '$device_present_state'"); - # Check if present - if ($device_present_state =~ /off_and_secured|off_or_removed/i) { - next; - } - - # Check global health - if ($device_health_status != 1) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "Storage Device '" . $device_name . "' Smart Health problem '" . $device_health_state . "'"); - } - $self->{output}->output_add(long_msg => " Smart Health status = '" . $device_health_status . "', Smart Health state = '" . $device_health_state . "'"); - - # Check temperature - if ($device_temperature >= $device_temperature_critical) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "Device Storage '" . $device_name . "' temperature too high"); - } elsif ($device_temperature >= $device_temperature_limit) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "Device Storage '" . $device_name . "' over the limit"); - } - $self->{output}->output_add(long_msg => " Temperature value = '" . $device_temperature . "' (limit >= $device_temperature_limit, critical >= $device_temperature_critical)"); - $self->{output}->perfdata_add(label => $device_name . "_temp", - value => $device_temperature, - warning => $device_temperature_limit, critical => $device_temperature_critical); - } -} - -sub check_rc { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking raid controllers"); - return if ($self->check_exclude('rc')); - - my $rc_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.4.3.0"; - my $rc_name_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.4.1.2'; - my $rc_state_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.4.1.90'; - my $rc_status_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.4.1.91'; - return if ($self->{global_information}->{$rc_count_oid} == 0); - - $self->{snmp}->load(oids => [$rc_name_oid, $rc_state_oid, - $rc_status_oid], - begin => 1, end => $self->{global_information}->{$rc_count_oid}); - my $result = $self->{snmp}->get_leef(); - return if (scalar(keys %$result) <= 0); - - my $number_rc = $self->{global_information}->{$rc_count_oid}; - for (my $i = 1; $i <= $number_rc; $i++) { - my $rc_name = $result->{$rc_name_oid . "." . $i}; - my $rc_state = $result->{$rc_state_oid . "." . $i}; - my $rc_status = $result->{$rc_status_oid . "." . $i}; - - $self->{components_rc}++; - - if ($rc_status != 1) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "Raid Device (Controller) '" . $rc_name . "' problem '" . $rc_state . "'"); - } - $self->{output}->output_add(long_msg => "Raid Device (Controller) '" . $rc_name . "' status = '" . $rc_status . "', state = '" . $rc_state . "'"); - } -} - -sub check_ro { - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking raid os devices"); - return if ($self->check_exclude('ro')); - - my $raid_os_count_oid = ".1.3.6.1.4.1.9804.3.1.1.2.4.50.0"; - my $raid_os_name_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.51.1.2'; - my $raid_os_state_oid = '.1.3.6.1.4.1.9804.3.1.1.2.4.51.1.90'; # != 'normal' - return if ($self->{global_information}->{$raid_os_count_oid} == 0); - - $self->{snmp}->load(oids => [$raid_os_name_oid, $raid_os_state_oid], - begin => 1, end => $self->{global_information}->{$raid_os_count_oid}); - my $result = $self->{snmp}->get_leef(); - return if (scalar(keys %$result) <= 0); - - my $number_ro = $self->{global_information}->{$raid_os_count_oid}; - for (my $i = 1; $i <= $number_ro; $i++) { - my $ro_name = $arg_result->{values}->{$raid_os_name_oid . "." . $i}; - my $ro_state = $arg_result->{values}->{$raid_os_state_oid . "." . $i}; - - $self->{components_ro}++; - - if ($ro_state !~ /normal/i) { - $self->{output}->output_add(severity => 'CRITICAL', - short_msg => "Raid OS Device '" . $ro_name . "' problem '" . $ro_state . "'"); - } - $self->{output}->output_add(long_msg => "Raid OS Device '" . $ro_name . "' state = '" . $ro_state . "'"); - } -} - sub check_exclude { my ($self, $section) = @_; @@ -512,6 +176,11 @@ Check Hardware (fans, power supplies, temperatures, voltages, raid controller ca =over 8 +=item B<--component> + +Which component to check (Default: 'all'). +Can be: 'fan', 'rcc', 'temperature', 'psu', 'voltage', 'device', 'rc', 'ro'. + =item B<--exclude> Exclude some parts (comma seperated list) (Example: --exclude=psu,rcc).