diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/battery.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/battery.pm deleted file mode 100644 index 4ecc140bf..000000000 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/battery.pm +++ /dev/null @@ -1,86 +0,0 @@ -# -# Copyright 2015 Centreon (http://www.centreon.com/) -# -# 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::server::dell::openmanage::mode::components::battery; - -use strict; -use warnings; - -my %status = ( - 1 => ['other', 'CRITICAL'], - 2 => ['unknown', 'UNKNOWN'], - 3 => ['ok', 'OK'], - 4 => ['nonCritical', 'WARNING'], - 5 => ['critical', 'CRITICAL'], - 6 => ['nonRecoverable', 'CRITICAL'], -); - -my %reading = ( - 1 => 'Predictive Failure', - 2 => 'Failed', - 4 => 'Presence Detected', -); - -sub check { - my ($self) = @_; - - # In MIB '10892.mib' - $self->{output}->output_add(long_msg => "Checking batteries"); - $self->{components}->{battery} = {name => 'batteries', total => 0}; - return if ($self->check_exclude('battery')); - - my $oid_batteryStatus = '.1.3.6.1.4.1.674.10892.1.600.50.1.5'; - my $oid_batteryReading = '.1.3.6.1.4.1.674.10892.1.600.50.1.6'; - my $oid_batteryLocationName = '.1.3.6.1.4.1.674.10892.1.600.50.1.7'; - - my $result = $self->{snmp}->get_table(oid => $oid_batteryStatus); - return if (scalar(keys %$result) <= 0); - - $self->{snmp}->load(oids => [$oid_batteryReading, $oid_batteryLocationName], - instances => [keys %$result], - instance_regexp => '(\d+\.\d+)$'); - my $result2 = $self->{snmp}->get_leef(); - return if (scalar(keys %$result2) <= 0); - - foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) { - $key =~ /(\d+)\.(\d+)$/; - my ($chassis_Index, $battery_Index) = ($1, $2); - my $instance = $chassis_Index . '.' . $battery_Index; - - my $battery_status = $result->{$key}; - my $battery_reading = $result2->{$oid_batteryReading . '.' . $instance}; - my $battery_locationName = $result2->{$oid_batteryLocationName . '.' . $instance}; - - $self->{components}->{battery}->{total}++; - $self->{output}->output_add(long_msg => sprintf("battery %d status is %s, reading is %s [location: %s].", - $battery_Index, ${$status{$battery_status}}[0], $reading{$battery_reading}, - $battery_locationName - )); - - if ($battery_status != 3) { - $self->{output}->output_add(severity => ${$status{$battery_status}}[1], - short_msg => sprintf("battery %d status is %s", - $battery_Index, ${$status{$battery_status}}[0])); - } - - } -} - -1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/cachebattery.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/cachebattery.pm deleted file mode 100644 index ee92e589f..000000000 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/cachebattery.pm +++ /dev/null @@ -1,108 +0,0 @@ -# -# Copyright 2015 Centreon (http://www.centreon.com/) -# -# 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::server::dell::openmanage::mode::components::cachebattery; - -use strict; -use warnings; - -my %state = ( - 0 => 'unknown', - 1 => 'ready', - 2 => 'failed', - 6 => 'degraded', - 7 => 'reconditioning', - 9 => 'high', - 10 => 'powerLow', - 12 => 'charging', - 21 => 'missing', - 36 => 'learning', -); - -my %componentStatus = ( - 1 => ['other', 'UNKNOWN'], - 2 => ['unknown', 'UNKNOWN'], - 3 => ['ok', 'OK'], - 4 => ['nonCritical', 'WARNING'], - 5 => ['critical', 'CRITICAL'], - 6 => ['nonRecoverable', 'CRITICAL'], -); - -my %learnState = ( - 1 => 'failed', - 2 => 'active', - 4 => 'timedOut', - 8 => 'requested', - 16 => 'idle', - 32 => 'due', -); - -my %predictedCapacity = ( - 1 => 'failed', - 2 => 'ready', - 4 => 'unknown', -); - -sub check { - my ($self) = @_; - - # In MIB '10893.mib' - $self->{output}->output_add(long_msg => "Checking cache batteries"); - $self->{components}->{cachebattery} = {name => 'cache batteries', total => 0}; - return if ($self->check_exclude('cachebattery')); - - my $oid_batteryState = '.1.3.6.1.4.1.674.10893.1.20.130.15.1.4'; - my $oid_batteryComponentStatus = '.1.3.6.1.4.1.674.10893.1.20.130.15.1.6'; - my $oid_batteryPredictedCapicity = '.1.3.6.1.4.1.674.10893.1.20.130.15.1.10'; - my $oid_batteryLearnState = '.1.3.6.1.4.1.674.10893.1.20.130.15.1.12'; - - my $result = $self->{snmp}->get_table(oid => $oid_batteryState); - return if (scalar(keys %$result) <= 0); - - $self->{snmp}->load(oids => [$oid_batteryComponentStatus, $oid_batteryPredictedCapicity, $oid_batteryLearnState], - instances => [keys %$result], - instance_regexp => '(\d+)$'); - my $result2 = $self->{snmp}->get_leef(); - return if (scalar(keys %$result2) <= 0); - - foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) { - $key =~ /(\d+)$/; - my $battery_Index = $1; - - my $battery_State = $result->{$key}; - my $battery_ComponentStatus = $result2->{$oid_batteryComponentStatus . '.' . $battery_Index}; - my $battery_PredictedCapacity = $result2->{$oid_batteryPredictedCapicity . '.' . $battery_Index}; - my $battery_LearnState = $result2->{$oid_batteryLearnState . '.' . $battery_Index}; - - $self->{components}->{cachebattery}->{total}++; - $self->{output}->output_add(long_msg => sprintf("cache battery %d status is %s, state is %s, learn state is %s, predicted capacity is %s.", - $battery_Index, ${$componentStatus{$battery_ComponentStatus}}[0], $state{$battery_State}, - $learnState{$battery_LearnState}, $predictedCapacity{$battery_PredictedCapacity} - )); - if ($battery_ComponentStatus != 3) { - $self->{output}->output_add(severity => ${$componentStatus{$battery_ComponentStatus}}[1], - short_msg => sprintf("cache battery %d status is %s", - $battery_Index, ${$componentStatus{$battery_ComponentStatus}}[0])); - } - - } -} - -1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/connector.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/connector.pm deleted file mode 100644 index 21abefa51..000000000 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/connector.pm +++ /dev/null @@ -1,100 +0,0 @@ -# -# Copyright 2015 Centreon (http://www.centreon.com/) -# -# 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::server::dell::openmanage::mode::components::connector; - -use strict; -use warnings; - -my %state = ( - 0 => 'unknown', - 1 => 'ready', - 2 => 'failed', - 3 => 'online', - 4 => 'offline', - 6 => 'degraded', -); - -my %status = ( - 1 => ['other', 'UNKNOWN'], - 2 => ['unknown', 'UNKNOWN'], - 3 => ['ok', 'OK'], - 4 => ['nonCritical', 'WARNING'], - 5 => ['critical', 'CRITICAL'], - 6 => ['nonRecoverable', 'CRITICAL'], -); - -my %busType = ( - 1 => 'SCSI', - 2 => 'IDE', - 3 => 'Fibre Channel', - 4 => 'SSA', - 6 => 'USB', - 7 => 'SATA', - 8 => 'SAS', -); - -sub check { - my ($self) = @_; - - # In MIB '10893.mib' - $self->{output}->output_add(long_msg => "Checking Connectors (Channels)"); - $self->{components}->{connector} = {name => 'connectors', total => 0}; - return if ($self->check_exclude('connector')); - - my $oid_channelName = '.1.3.6.1.4.1.674.10893.1.20.130.2.1.2'; - my $oid_channelState = '.1.3.6.1.4.1.674.10893.1.20.130.2.1.3'; - my $oid_channelComponentStatus = '.1.3.6.1.4.1.674.10893.1.20.130.2.1.8'; - my $oid_channelBusType = '.1.3.6.1.4.1.674.10893.1.20.130.2.1.11'; - - my $result = $self->{snmp}->get_table(oid => $oid_channelName); - return if (scalar(keys %$result) <= 0); - - $self->{snmp}->load(oids => [$oid_channelState, $oid_channelComponentStatus, $oid_channelBusType], - instances => [keys %$result], - instance_regexp => '(\d+)$'); - my $result2 = $self->{snmp}->get_leef(); - return if (scalar(keys %$result2) <= 0); - - foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) { - $key =~ /(\d+)$/; - my $channel_Index = $1; - - my $channel_name = $result->{$key}; - my $channel_state = $result2->{$oid_channelState . '.' . $channel_Index}; - my $channel_componentStatus = $result2->{$oid_channelComponentStatus . '.' . $channel_Index}; - my $channel_busType = $result2->{$oid_channelBusType . '.' . $channel_Index}; - - $self->{components}->{connector}->{total}++; - $self->{output}->output_add(long_msg => sprintf("connector '%s' status is '%s', state is '%s' [index: %d, bus: %s].", - $channel_name, ${$status{$channel_componentStatus}}[0], $state{$channel_state}, - $channel_Index, $busType{$channel_busType} - )); - - if ($channel_componentStatus != 3) { - $self->{output}->output_add(severity => ${$status{$channel_componentStatus}}[1], - short_msg => sprintf("connector '%s' status is '%s' [index: %d, bus: %s]", - $channel_name, ${$status{$channel_componentStatus}}[0], $channel_Index, $busType{$channel_busType})); - } - - } -} - -1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/controller.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/controller.pm deleted file mode 100644 index dd8b809ea..000000000 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/controller.pm +++ /dev/null @@ -1,90 +0,0 @@ -# -# Copyright 2015 Centreon (http://www.centreon.com/) -# -# 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::server::dell::openmanage::mode::components::controller; - -use strict; -use warnings; - -my %state = ( - 0 => 'unknown', - 1 => 'ready', - 2 => 'failed', - 3 => 'online', - 4 => 'offline', - 6 => 'degraded', -); - -my %status = ( - 1 => ['other', 'UNKNOWN'], - 2 => ['unknown', 'UNKNOWN'], - 3 => ['ok', 'OK'], - 4 => ['nonCritical', 'WARNING'], - 5 => ['critical', 'CRITICAL'], - 6 => ['nonRecoverable', 'CRITICAL'], -); - -sub check { - my ($self) = @_; - - # In MIB '10893.mib' - $self->{output}->output_add(long_msg => "Checking Controllers"); - $self->{components}->{controller} = {name => 'controllers', total => 0}; - return if ($self->check_exclude('controller')); - - my $oid_controllerName = '.1.3.6.1.4.1.674.10893.1.20.130.1.1.2'; - my $oid_controllerState = '.1.3.6.1.4.1.674.10893.1.20.130.1.1.5'; - my $oid_controllerComponentStatus = '.1.3.6.1.4.1.674.10893.1.20.130.1.1.38'; - my $oid_controllerFWVersion = '.1.3.6.1.4.1.674.10893.1.20.130.1.1.8'; - - my $result = $self->{snmp}->get_table(oid => $oid_controllerName); - return if (scalar(keys %$result) <= 0); - - $self->{snmp}->load(oids => [$oid_controllerState, $oid_controllerComponentStatus, $oid_controllerFWVersion], - instances => [keys %$result], - instance_regexp => '(\d+)$'); - my $result2 = $self->{snmp}->get_leef(); - return if (scalar(keys %$result2) <= 0); - - foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) { - $key =~ /(\d+)$/; - my $controller_Index = $1; - - my $controller_name = $result->{$key}; - my $controller_state = $result2->{$oid_controllerState . '.' . $controller_Index}; - my $controller_componentStatus = $result2->{$oid_controllerComponentStatus . '.' . $controller_Index}; - my $controller_FWVersion = $result2->{$oid_controllerFWVersion . '.' . $controller_Index}; - - $self->{components}->{controller}->{total}++; - $self->{output}->output_add(long_msg => sprintf("controller '%s' status is '%s', state is '%s' [index: %d, firmware: %s].", - $controller_name, ${$status{$controller_componentStatus}}[0], $state{$controller_state}, - $controller_Index, $controller_FWVersion - )); - - if ($controller_componentStatus != 3) { - $self->{output}->output_add(severity => ${$status{$controller_componentStatus}}[1], - short_msg => sprintf("controller '%s' status is '%s' [index: %d]", - $controller_name, ${$status{$controller_componentStatus}}[0], $controller_Index)); - } - - } -} - -1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/cpu.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/cpu.pm deleted file mode 100644 index 69f411f67..000000000 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/cpu.pm +++ /dev/null @@ -1,107 +0,0 @@ -# -# Copyright 2015 Centreon (http://www.centreon.com/) -# -# 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::server::dell::openmanage::mode::components::cpu; - -use strict; -use warnings; - -my %status = ( - 1 => ['other', 'CRITICAL'], - 2 => ['unknown', 'UNKNOWN'], - 3 => ['ok', 'OK'], - 4 => ['nonCritical', 'WARNING'], - 5 => ['critical', 'CRITICAL'], - 6 => ['nonRecoverable', 'CRITICAL'], -); - -my %statusState = ( - 1 => 'other', - 2 => 'unknown', - 3 => 'enabled', - 4 => 'userDisabled', - 5 => 'biosDisabled', - 6 => 'idle', -); - -my %statusReading = ( - 1 => 'internalError', - 2 => 'thermalTrip', - 32 => 'configurationError', - 128 => 'Present', - 256 => 'Disabled', - 512 => 'terminatorPresent', - 1024 => 'throttled', -); - -sub check { - my ($self) = @_; - - # In MIB '10892.mib' - $self->{output}->output_add(long_msg => "Checking Processor Units"); - $self->{components}->{cpu} = {name => 'CPUs', total => 0}; - return if ($self->check_exclude('cpu')); - - my $oid_cpuStatus = '.1.3.6.1.4.1.674.10892.1.1100.30.1.5'; - my $oid_cpuManufacturerName = '.1.3.6.1.4.1.674.10892.1.1100.30.1.8'; - my $oid_cpuStatusState = '.1.3.6.1.4.1.674.10892.1.1100.30.1.9'; - my $oid_cpuCurrentSpeed = '.1.3.6.1.4.1.674.10892.1.1100.30.1.12'; - my $oid_cpuBrandName = '.1.3.6.1.4.1.674.10892.1.1100.30.1.23'; - my $oid_cpuChassis = '.1.3.6.1.4.1.674.10892.1.1100.32.1.1'; - my $oid_cpuStatusReading = '.1.3.6.1.4.1.674.10892.1.1100.32.1.6'; - - my $result = $self->{snmp}->get_table(oid => $oid_cpuStatus); - return if (scalar(keys %$result) <= 0); - - $self->{snmp}->load(oids => [$oid_cpuManufacturerName, $oid_cpuStatusState, $oid_cpuCurrentSpeed, $oid_cpuBrandName, $oid_cpuChassis, $oid_cpuStatusReading], - instances => [keys %$result], - instance_regexp => '(\d+\.\d+)$'); - my $result2 = $self->{snmp}->get_leef(); - return if (scalar(keys %$result2) <= 0); - - foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) { - $key =~ /(\d+)\.(\d+)$/; - my ($chassis_Index, $cpu_Index) = ($1, $2); - my $instance = $chassis_Index . '.' . $cpu_Index; - - my $cpu_Status = $result->{$key}; - my $cpu_ManufacturerName = $result2->{$oid_cpuManufacturerName . '.' . $instance}; - my $cpu_StatusState = $result2->{$oid_cpuStatusState . '.' . $instance}; - my $cpu_CurrentSpeed = $result2->{$oid_cpuCurrentSpeed . '.' . $instance}; - my $cpu_BrandName = $result2->{$oid_cpuBrandName . '.' . $instance}; - my $cpu_Chassis = $result2->{$oid_cpuChassis . '.' . $instance}; - my $cpu_StatusReading = $result2->{$oid_cpuStatusReading . '.' . $instance}; - - $self->{components}->{cpu}->{total}++; - $self->{output}->output_add(long_msg => sprintf("cpu %d status is %s, state is %s, current speed is %d MHz [model: %s].", - $cpu_Index, ${$status{$cpu_Status}}[0], $statusState{$cpu_StatusState}, - $cpu_CurrentSpeed, $cpu_BrandName - )); - - if ($cpu_Status != 3) { - $self->{output}->output_add(severity => ${$status{$cpu_Status}}[1], - short_msg => sprintf("cpu %d status is %s", - $cpu_Index, ${$status{$cpu_Status}}[0])); - } - - } -} - -1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/esmlog.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/esmlog.pm deleted file mode 100644 index 865bc72d0..000000000 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/esmlog.pm +++ /dev/null @@ -1,58 +0,0 @@ -# -# Copyright 2015 Centreon (http://www.centreon.com/) -# -# 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::server::dell::openmanage::mode::components::esmlog; - -use strict; -use warnings; - -my %status = ( - 1 => ['other', 'CRITICAL'], - 2 => ['unknown', 'UNKNOWN'], - 3 => ['ok', 'OK'], - 4 => ['nonCritical', 'WARNING'], - 5 => ['critical', 'CRITICAL'], - 6 => ['nonRecoverable', 'CRITICAL'], -); - -sub check { - my ($self) = @_; - - # In MIB '10892.mib' - $self->{output}->output_add(long_msg => "Checking ESM log filling"); - $self->{components}->{esmlog} = {name => 'ESM log', total => 0}; - return if ($self->check_exclude('esmlog')); - - my $oid_eventLogStatus = '.1.3.6.1.4.1.674.10892.1.200.10.1.41.1'; - my $result = $self->{snmp}->get_leef(oids => [$oid_eventLogStatus], nothing_quit => 1); - - $self->{components}->{esmlog}->{total}++; - $self->{output}->output_add(long_msg => sprintf("ESM log status is '%s'.", - ${$status{$result->{$oid_eventLogStatus}}}[0] - )); - - if ($result->{$oid_eventLogStatus} != 3) { - $self->{output}->output_add(severity => ${$status{$result->{$oid_eventLogStatus}}}[1], - short_msg => sprintf("ESM log status is '%s'", - ${$status{$result->{$oid_eventLogStatus}}}[0])); - } -} - -1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/fan.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/fan.pm deleted file mode 100644 index 0e5e75245..000000000 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/fan.pm +++ /dev/null @@ -1,83 +0,0 @@ -# -# Copyright 2015 Centreon (http://www.centreon.com/) -# -# 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::server::dell::openmanage::mode::components::fan; - -use strict; -use warnings; - -my %status = ( - 1 => ['other', 'CRITICAL'], - 2 => ['unknown', 'UNKNOWN'], - 3 => ['ok', 'OK'], - 4 => ['nonCriticalUpper', 'WARNING'], - 5 => ['criticalUpper', 'CRITICAL'], - 6 => ['nonRecoverableUpper', 'CRITICAL'], - 7 => ['nonCriticalLower', 'WARNING'], - 8 => ['criticalLower', 'CRITICAL'], - 9 => ['nonRecoverableLower', 'CRITICAL'], - 10 => ['failed', 'CRITICAL'] - -); - -sub check { - my ($self) = @_; - - # In MIB '10892.mib' - $self->{output}->output_add(long_msg => "Checking fans"); - $self->{components}->{fan} = {name => 'fans', total => 0}; - return if ($self->check_exclude('fan')); - - my $oid_coolingDeviceStatus = '.1.3.6.1.4.1.674.10892.1.700.12.1.5'; - my $oid_coolingDeviceReading = '.1.3.6.1.4.1.674.10892.1.700.12.1.6'; - my $oid_coolingDeviceLocationName = '.1.3.6.1.4.1.674.10892.1.700.12.1.8'; - - my $result = $self->{snmp}->get_table(oid => $oid_coolingDeviceStatus); - return if (scalar(keys %$result) <= 0); - - $self->{snmp}->load(oids => [$oid_coolingDeviceReading, $oid_coolingDeviceLocationName], - instances => [keys %$result], - instance_regexp => '(\d+\.\d+)$'); - my $result2 = $self->{snmp}->get_leef(); - return if (scalar(keys %$result2) <= 0); - - foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) { - $key =~ /(\d+)\.(\d+)$/; - my ($chassis_Index, $fan_Index) = ($1, $2); - my $instance = $chassis_Index . '.' . $fan_Index; - - my $fan_Status = $result->{$key}; - my $fan_Reading = $result2->{$oid_coolingDeviceReading . '.' . $instance}; - my $fan_LocationName = $result2->{$oid_coolingDeviceLocationName . '.' . $instance}; - - $self->{components}->{fan}->{total}++; - $self->{output}->output_add(long_msg => sprintf("fan %d status is %s, speed is %d RPM [location: %s].", - $fan_Index, ${$status{$fan_Status}}[0], $fan_Reading, - $fan_LocationName - )); - if ($fan_Status != 3) { - $self->{output}->output_add(severity => ${$status{$fan_Status}}[1], - short_msg => sprintf("fan %d status is %s", - $fan_Index, ${$status{$fan_Status}}[0])); - } - } -} - -1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/globalstatus.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/globalstatus.pm deleted file mode 100644 index d66d946ef..000000000 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/globalstatus.pm +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright 2015 Centreon (http://www.centreon.com/) -# -# 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::server::dell::openmanage::mode::components::globalstatus; - -use strict; -use warnings; - -my %status = ( - 1 => ['other', 'CRITICAL'], - 2 => ['unknown', 'UNKNOWN'], - 3 => ['ok', 'OK'], - 4 => ['nonCritical', 'WARNING'], - 5 => ['critical', 'CRITICAL'], - 6 => ['nonRecoverable', 'CRITICAL'], -); - -sub check { - my ($self) = @_; - - # In MIB '10892.mib' - $self->{output}->output_add(long_msg => "Checking global system status"); - return if ($self->check_exclude('globalstatus')); - - my $oid_globalSystemStatus = '.1.3.6.1.4.1.674.10892.1.200.10.1.2.1'; - my $result = $self->{snmp}->get_leef(oids => [$oid_globalSystemStatus], nothing_quit => 1); - - $self->{output}->output_add(long_msg => sprintf("Overall global status is '%s'.", - ${$status{$result->{$oid_globalSystemStatus}}}[0] - )); - - if ($result->{$oid_globalSystemStatus} != 3) { - $self->{output}->output_add(severity => ${$status{$result->{$oid_globalSystemStatus}}}[1], - short_msg => sprintf("Overall global status is '%s'", - ${$status{$result->{$oid_globalSystemStatus}}}[0])); - } -} - -1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/logicaldrive.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/logicaldrive.pm deleted file mode 100644 index 9be3ad28e..000000000 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/logicaldrive.pm +++ /dev/null @@ -1,121 +0,0 @@ -# -# Copyright 2015 Centreon (http://www.centreon.com/) -# -# 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::server::dell::openmanage::mode::components::logicaldrive; - -use strict; -use warnings; - -my %state = ( - 0 => 'unknown', - 1 => 'ready', - 2 => 'failed', - 3 => 'online', - 4 => 'offline', - 6 => 'degraded', - 15 => 'resynching', - 24 => 'rebuild', - 26 => 'formatting', - 35 => 'initializing', -); - -my %layout = ( - 1 => 'Concatened', - 2 => 'RAID-0', - 3 => 'RAID-1', - 4 => 'RAID-2', - 5 => 'RAID-3', - 6 => 'RAID-4', - 7 => 'RAID-5', - 8 => 'RAID-6', - 9 => 'RAID-7', - 10 => 'RAID-10', - 11 => 'RAID-30', - 12 => 'RAID-50', - 13 => 'Add spares', - 14 => 'Delete logical', - 15 => 'Transform logical', - 18 => 'RAID-0-plus-1 - Mylex only', - 19 => 'Concatened RAID 1', - 20 => 'Concatened RAID 5', - 21 => 'no RAID', - 22 => 'RAID Morph - Adapted only', -); - -my %componentStatus = ( - 1 => ['other', 'UNKNOWN'], - 2 => ['unknown', 'UNKNOWN'], - 3 => ['ok', 'OK'], - 4 => ['nonCritical', 'WARNING'], - 5 => ['critical', 'CRITICAL'], - 6 => ['nonRecoverable', 'CRITICAL'], -); - -sub check { - my ($self) = @_; - - # In MIB '10893.mib' - $self->{output}->output_add(long_msg => "Checking Logical Drives"); - $self->{components}->{logicaldrive} = {name => 'logical drives', total => 0}; - return if ($self->check_exclude('logicaldrive')); - - my $oid_diskName = '.1.3.6.1.4.1.674.10893.1.20.140.1.1.2'; - my $oid_diskDeviceName = '.1.3.6.1.4.1.674.10893.1.20.140.1.1.3'; - my $oid_diskState = '.1.3.6.1.4.1.674.10893.1.20.140.1.1.4'; - my $oid_diskLengthInMB = '.1.3.6.1.4.1.674.10893.1.20.140.1.1.6'; - my $oid_diskLayout = '.1.3.6.1.4.1.674.10893.1.20.140.1.1.13'; - my $oid_diskComponentStatus = '.1.3.6.1.4.1.674.10893.1.20.140.1.1.20'; - - my $result = $self->{snmp}->get_table(oid => $oid_diskName); - return if (scalar(keys %$result) <= 0); - - $self->{snmp}->load(oids => [$oid_diskDeviceName, $oid_diskState, $oid_diskLengthInMB, $oid_diskLayout, $oid_diskComponentStatus], - instances => [keys %$result], - instance_regexp => '(\d+)$'); - my $result2 = $self->{snmp}->get_leef(); - return if (scalar(keys %$result2) <= 0); - - foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) { - $key =~ /(\d+)$/; - my $disk_Index = $1; - - my $disk_Name = $result->{$key}; - my $disk_DeviceName = $result2->{$oid_diskDeviceName . '.' . $disk_Index}; - my $disk_State = $result2->{$oid_diskState . '.' . $disk_Index}; - my $disk_LengthInMB = $result2->{$oid_diskLengthInMB . '.' . $disk_Index}; - my $disk_Layout = $result2->{$oid_diskLayout . '.' . $disk_Index}; - my $disk_ComponentStatus = $result2->{$oid_diskComponentStatus . '.' . $disk_Index}; - - $self->{components}->{logicaldrive}->{total}++; - $self->{output}->output_add(long_msg => sprintf("logical drive %s status is %s, state is %s, layout is %s, size is %d MB [device: %s, index: %d].", - $disk_Name, ${$componentStatus{$disk_ComponentStatus}}[0], $state{$disk_State}, - $layout{$disk_Layout}, $disk_LengthInMB, $disk_DeviceName, $disk_Index - )); - - if ($disk_ComponentStatus != 3) { - $self->{output}->output_add(severity => ${$componentStatus{$disk_ComponentStatus}}[1], - short_msg => sprintf("logical drive %s status is %s [device: %s, index: %d]", - $disk_Name, ${$componentStatus{$disk_ComponentStatus}}[0], $disk_DeviceName, $disk_Index)); - } - - } -} - -1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/memory.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/memory.pm deleted file mode 100644 index 9ba097120..000000000 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/memory.pm +++ /dev/null @@ -1,91 +0,0 @@ -# -# Copyright 2015 Centreon (http://www.centreon.com/) -# -# 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::server::dell::openmanage::mode::components::memory; - -use strict; -use warnings; - -my %status = ( - 1 => ['other', 'CRITICAL'], - 2 => ['unknown', 'UNKNOWN'], - 3 => ['ok', 'OK'], - 4 => ['nonCritical', 'WARNING'], - 5 => ['critical', 'CRITICAL'], - 6 => ['nonRecoverable', 'CRITICAL'], -); - -my %failureModes = ( - 0 => 'Not failure', - 1 => 'ECC single bit correction warning rate exceeded', - 2 => 'ECC single bit correction failure rate exceeded', - 4 => 'ECC multibit fault encountered', - 8 => 'ECC single bit correction logging disabled', - 16 => 'device disabled because of spare activation', -); - -sub check { - my ($self) = @_; - - # In MIB '10892.mib' - $self->{output}->output_add(long_msg => "Checking Memory Modules"); - $self->{components}->{memory} = {name => 'memory modules', total => 0}; - return if ($self->check_exclude('memory')); - - my $oid_memoryDeviceStatus = '.1.3.6.1.4.1.674.10892.1.1100.50.1.5'; - my $oid_memoryDeviceLocationName = '.1.3.6.1.4.1.674.10892.1.1100.50.1.8'; - my $oid_memoryDeviceSize = '.1.3.6.1.4.1.674.10892.1.1100.50.1.14'; - my $oid_memoryDeviceFailureModes = '.1.3.6.1.4.1.674.10892.1.1100.50.1.20'; - - my $result = $self->{snmp}->get_table(oid => $oid_memoryDeviceStatus); - return if (scalar(keys %$result) <= 0); - - $self->{snmp}->load(oids => [$oid_memoryDeviceLocationName, $oid_memoryDeviceSize, $oid_memoryDeviceFailureModes], - instances => [keys %$result], - instance_regexp => '(\d+\.\d+)$'); - my $result2 = $self->{snmp}->get_leef(); - return if (scalar(keys %$result2) <= 0); - - foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) { - $key =~ /(\d+)\.(\d+)$/; - my ($chassis_Index, $memory_Index) = ($1, $2); - my $instance = $chassis_Index . '.' . $memory_Index; - - my $memory_deviceStatus = $result->{$key}; - my $memory_deviceLocationName = $result2->{$oid_memoryDeviceLocationName . '.' . $instance}; - my $memory_deviceSize = $result2->{$oid_memoryDeviceSize . '.' . $instance}; - my $memory_deviceFailureModes = $result2->{$oid_memoryDeviceFailureModes . '.' . $instance}; - - $self->{components}->{memory}->{total}++; - $self->{output}->output_add(long_msg => sprintf("memory module %d status is %s, failure mode is %s, size is %d KB [location: %s].", - $memory_Index, ${$status{$memory_deviceStatus}}[0], $failureModes{$memory_deviceFailureModes}, - $memory_deviceSize, $memory_deviceLocationName - )); - - if ($memory_deviceStatus != 3) { - $self->{output}->output_add(severity => ${$status{$memory_deviceStatus}}[1], - short_msg => sprintf("memory module %d status is %s", - $memory_Index, ${$status{$memory_deviceStatus}}[0])); - } - - } -} - -1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/physicaldisk.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/physicaldisk.pm deleted file mode 100644 index 5686d611b..000000000 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/physicaldisk.pm +++ /dev/null @@ -1,122 +0,0 @@ -# -# Copyright 2015 Centreon (http://www.centreon.com/) -# -# 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::server::dell::openmanage::mode::components::physicaldisk; - -use strict; -use warnings; - -my %state = ( - 0 => 'unknown', - 1 => 'ready', - 2 => 'failed', - 3 => 'online', - 4 => 'offline', - 6 => 'degraded', - 7 => 'recovering', - 11 => 'removed', - 15 => 'resynching', - 24 => 'rebuild', - 25 => 'noMedia', - 26 => 'formatting', - 28 => 'diagnostics', - 35 => 'initializing', -); - -my %spareState = ( - 1 => 'memberVD', - 2 => 'memberDG', - 3 => 'globalHostSpare', - 4 => 'dedicatedHostSpare', - 5 => 'notASpare', -); - -my %componentStatus = ( - 1 => ['other', 'UNKNOWN'], - 2 => ['unknown', 'UNKNOWN'], - 3 => ['ok', 'OK'], - 4 => ['nonCritical', 'WARNING'], - 5 => ['critical', 'CRITICAL'], - 6 => ['nonRecoverable', 'CRITICAL'], -); - -my %smartAlertIndication = ( - 1 => ['no', 'OK'], - 2 => ['yes', 'WARNING'], -); - -sub check { - my ($self) = @_; - - # In MIB '10893.mib' - $self->{output}->output_add(long_msg => "Checking Physical Disks"); - $self->{components}->{physicaldisk} = {name => 'physical disks', total => 0}; - return if ($self->check_exclude('physicaldisk')); - - my $oid_diskName = '.1.3.6.1.4.1.674.10893.1.20.130.4.1.2'; - my $oid_diskState = '.1.3.6.1.4.1.674.10893.1.20.130.4.1.4'; - my $oid_diskLengthInMB = '.1.3.6.1.4.1.674.10893.1.20.130.4.1.11'; - my $oid_diskSpareState = '.1.3.6.1.4.1.674.10893.1.20.130.4.1.22'; - my $oid_diskComponentStatus = '.1.3.6.1.4.1.674.10893.1.20.130.4.1.24'; - my $oid_diskSmartAlertIndication = '.1.3.6.1.4.1.674.10893.1.20.130.4.1.31'; - - my $result = $self->{snmp}->get_table(oid => $oid_diskName); - return if (scalar(keys %$result) <= 0); - - $self->{snmp}->load(oids => [$oid_diskState, $oid_diskLengthInMB, $oid_diskSpareState, $oid_diskComponentStatus, $oid_diskSmartAlertIndication], - instances => [keys %$result], - instance_regexp => '(\d+\.\d+)$'); - my $result2 = $self->{snmp}->get_leef(); - return if (scalar(keys %$result2) <= 0); - - foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) { - $key =~ /(\d+)\.(\d+)$/; - my ($chassis_Index, $disk_Index) = ($1, $2); - my $instance = $chassis_Index . '.' . $disk_Index; - - my $disk_Name = $result->{$key}; - my $disk_State = $result2->{$oid_diskState . '.' . $instance}; - my $disk_LengthInMB = $result2->{$oid_diskLengthInMB . '.' . $instance}; - my $disk_SpareState = $result2->{$oid_diskSpareState . '.' . $instance}; - my $disk_ComponentStatus = $result2->{$oid_diskComponentStatus . '.' . $instance}; - my $disk_SmartAlertIndication = $result2->{$oid_diskSmartAlertIndication . '.' . $instance}; - - $self->{components}->{physicaldisk}->{total}++; - $self->{output}->output_add(long_msg => sprintf("physical disk '%s' status is %s, state is %s, predictive failure alert %s, spare state is %s, size is %d MB [index: %d].", - $disk_Name, ${$componentStatus{$disk_ComponentStatus}}[0], $state{$disk_State}, ${$smartAlertIndication{$disk_SmartAlertIndication}}[0], - $spareState{$disk_SpareState}, $disk_LengthInMB, $disk_Index - )); - - if ($disk_SmartAlertIndication !=1) { - $self->{output}->output_add(severity => ${$smartAlertIndication{$disk_SmartAlertIndication}}[1], - short_msg => sprintf("physical disk '%s' has received a predictive failure alert [index: %d]", - $disk_Name, $disk_Index)); - } - - if ($disk_ComponentStatus != 3) { - $self->{output}->output_add(severity => ${$componentStatus{$disk_ComponentStatus}}[1], - short_msg => sprintf("physical disk '%s' status is %s [index: %d]", - $disk_Name, ${$componentStatus{$disk_ComponentStatus}}[0], $disk_Index)); - } - - } -} - -1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/psu.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/psu.pm deleted file mode 100644 index ddffa87ea..000000000 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/psu.pm +++ /dev/null @@ -1,111 +0,0 @@ -# -# Copyright 2015 Centreon (http://www.centreon.com/) -# -# 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::server::dell::openmanage::mode::components::psu; - -use strict; -use warnings; - -my %status = ( - 1 => ['other', 'CRITICAL'], - 2 => ['unknown', 'UNKNOWN'], - 3 => ['ok', 'OK'], - 4 => ['nonCritical', 'WARNING'], - 5 => ['critical', 'CRITICAL'], - 6 => ['nonRecoverable', 'CRITICAL'], -); - -my %type = ( - 1 => 'other', - 2 => 'unknown', - 3 => 'Linear', - 4 => 'switching', - 5 => 'Battery', - 6 => 'UPS', - 7 => 'Converter', - 8 => 'Regulator', - 9 => 'AC', - 10 => 'DC', - 11 => 'VRM', -); - -my %state = ( - 1 => 'present', - 2 => 'failure', - 4 => 'predictiveFailure', - 8 => 'ACLost', - 16 => 'ACLostOrOutOfRange', - 32 => 'ACPresentButOutOfRange', - 64 => 'configurationError', -); - -my %ConfigurationErrorType = ( - 1 => 'vendorMismatch', - 2 => 'revisionMismatch', - 3 => 'processorMissing', -); - -sub check { - my ($self) = @_; - - # In MIB '10892.mib' - $self->{output}->output_add(long_msg => "Checking power supplies"); - $self->{components}->{psu} = {name => 'power supplies', total => 0}; - return if ($self->check_exclude('psu')); - - my $oid_powerSupplyStatus = '.1.3.6.1.4.1.674.10892.1.600.12.1.5'; - my $oid_powerSupplyType = '.1.3.6.1.4.1.674.10892.1.600.12.1.7'; - my $oid_powerSupplySensorState = '.1.3.6.1.4.1.674.10892.1.600.12.1.11'; - my $oid_powerSupplyConfigurationErrorType = '.1.3.6.1.4.1.674.10892.1.600.12.1.12'; - - my $result = $self->{snmp}->get_table(oid => $oid_powerSupplyStatus); - return if (scalar(keys %$result) <= 0); - - $self->{snmp}->load(oids => [$oid_powerSupplyType, $oid_powerSupplySensorState, $oid_powerSupplyConfigurationErrorType], - instances => [keys %$result], - instance_regexp => '(\d+\.\d+)$'); - my $result2 = $self->{snmp}->get_leef(); - return if (scalar(keys %$result2) <= 0); - - foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) { - $key =~ /(\d+)\.(\d+)$/; - my ($chassis_Index, $psu_Index) = ($1, $2); - my $instance = $chassis_Index . '.' . $psu_Index; - - my $psu_Status = $result->{$key}; - my $psu_Type = $result2->{$oid_powerSupplyType . '.' . $instance}; - my $psu_SensorState = $result2->{$oid_powerSupplySensorState . '.' . $instance}; - my $psu_ConfigurationErrorType = $result2->{$oid_powerSupplyConfigurationErrorType . '.' . $instance}; - - $self->{components}->{psu}->{total}++; - $self->{output}->output_add(long_msg => sprintf("psu %d status is %s, state is %s [type: %s].", - $psu_Index, ${$status{$psu_Status}}[0], $state{$psu_SensorState}, - $type{$psu_Type} - )); - if ($psu_Status != 3) { - $self->{output}->output_add(severity => ${$status{$psu_Status}}[1], - short_msg => sprintf("psu %d status is %s", - $psu_Index, ${$status{$psu_Status}}[0])); - } - - } -} - -1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/components/temperature.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/components/temperature.pm deleted file mode 100644 index fc4948fc1..000000000 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/components/temperature.pm +++ /dev/null @@ -1,100 +0,0 @@ -# -# Copyright 2015 Centreon (http://www.centreon.com/) -# -# 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::server::dell::openmanage::mode::components::temperature; - -use strict; -use warnings; - -my %status = ( - 1 => ['other', 'CRITICAL'], - 2 => ['unknown', 'UNKNOWN'], - 3 => ['ok', 'OK'], - 4 => ['nonCriticalUpper', 'WARNING'], - 5 => ['criticalUpper', 'CRITICAL'], - 6 => ['nonRecoverableUpper', 'CRITICAL'], - 7 => ['nonCriticalLower', 'WARNING'], - 8 => ['criticalLower', 'CRITICAL'], - 9 => ['nonRecoverableLower', 'CRITICAL'], - 10 => ['failed', 'CRITICAL'], -); - -my %type = ( - 1 => 'other', - 2 => 'unknown', - 3 => 'Ambient ESM', - 4 => 'Discrete', -); - -my %discreteReading = ( - 1 => 'good', - 2 => 'bad', -); - - -sub check { - my ($self) = @_; - - # In MIB '10892.mib' - $self->{output}->output_add(long_msg => "Checking temperature probes"); - $self->{components}->{temperature} = {name => 'temperature probes', total => 0}; - return if ($self->check_exclude('temperature')); - - my $oid_temperatureProbeStatus = '.1.3.6.1.4.1.674.10892.1.700.20.1.5'; - my $oid_temperatureProbeReading = '.1.3.6.1.4.1.674.10892.1.700.20.1.6'; - my $oid_temperatureProbeType = '.1.3.6.1.4.1.674.10892.1.700.20.1.7'; - my $oid_temperatureProbeLocationName = '.1.3.6.1.4.1.674.10892.1.700.20.1.8'; - - my $result = $self->{snmp}->get_table(oid => $oid_temperatureProbeStatus); - return if (scalar(keys %$result) <= 0); - - $self->{snmp}->load(oids => [$oid_temperatureProbeReading, $oid_temperatureProbeType, $oid_temperatureProbeLocationName], - instances => [keys %$result], - instance_regexp => '(\d+\.\d+)$'); - my $result2 = $self->{snmp}->get_leef(); - return if (scalar(keys %$result2) <= 0); - - foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) { - $key =~ /(\d+)\.(\d+)$/; - my ($chassis_Index, $temperature_Index) = ($1, $2); - my $instance = $chassis_Index . '.' . $temperature_Index; - - my $temperature_Status = $result->{$key}; - my $temperature_Reading = $result2->{$oid_temperatureProbeReading . '.' . $instance}; - my $temperature_Type = $result2->{$oid_temperatureProbeType . '.' . $instance}; - my $temperature_LocationName = $result2->{$oid_temperatureProbeLocationName . '.' . $instance}; - - my $temperature_Reading2 = $temperature_Reading/10; - - $self->{components}->{temperature}->{total}++; - $self->{output}->output_add(long_msg => sprintf("temperature probe %d status is %s, temperature is %.1f °C [location: %s].", - $temperature_Index, ${$status{$temperature_Status}}[0], $temperature_Reading2, - $temperature_LocationName - )); - if ($temperature_Status != 3) { - $self->{output}->output_add(severity => ${$status{$temperature_Status}}[1], - short_msg => sprintf("temperature probe %d status is %s", - $temperature_Index, ${$status{$temperature_Status}}[0])); - } - - } -} - -1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/mode/hardware.pm b/centreon-plugins/hardware/server/dell/openmanage/mode/hardware.pm deleted file mode 100644 index 1d5872b1c..000000000 --- a/centreon-plugins/hardware/server/dell/openmanage/mode/hardware.pm +++ /dev/null @@ -1,247 +0,0 @@ -# -# Copyright 2015 Centreon (http://www.centreon.com/) -# -# 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::server::dell::openmanage::mode::hardware; - -use base qw(centreon::plugins::mode); - -use strict; -use warnings; -use centreon::plugins::misc; -use hardware::server::dell::openmanage::mode::components::globalstatus; -use hardware::server::dell::openmanage::mode::components::fan; -use hardware::server::dell::openmanage::mode::components::psu; -use hardware::server::dell::openmanage::mode::components::temperature; -use hardware::server::dell::openmanage::mode::components::cpu; -use hardware::server::dell::openmanage::mode::components::cachebattery; -use hardware::server::dell::openmanage::mode::components::memory; -use hardware::server::dell::openmanage::mode::components::physicaldisk; -use hardware::server::dell::openmanage::mode::components::logicaldrive; -use hardware::server::dell::openmanage::mode::components::esmlog; -use hardware::server::dell::openmanage::mode::components::battery; -use hardware::server::dell::openmanage::mode::components::controller; -use hardware::server::dell::openmanage::mode::components::connector; - -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 => - { - "exclude:s" => { name => 'exclude' }, - "component:s" => { name => 'component', default => 'all' }, - }); - - $self->{product_name} = undef; - $self->{components} = {}; - return $self; -} - -sub check_options { - my ($self, %options) = @_; - $self->SUPER::init(%options); -} - -sub global { - my ($self, %options) = @_; - - $self->get_system_information(); - hardware::server::dell::openmanage::mode::components::globalstatus::check($self); - hardware::server::dell::openmanage::mode::components::fan::check($self); - hardware::server::dell::openmanage::mode::components::psu::check($self); - hardware::server::dell::openmanage::mode::components::temperature::check($self); - hardware::server::dell::openmanage::mode::components::cpu::check($self); - hardware::server::dell::openmanage::mode::components::cachebattery::check($self); - hardware::server::dell::openmanage::mode::components::memory::check($self); - hardware::server::dell::openmanage::mode::components::physicaldisk::check($self); - hardware::server::dell::openmanage::mode::components::logicaldrive::check($self); - hardware::server::dell::openmanage::mode::components::esmlog::check($self); - hardware::server::dell::openmanage::mode::components::battery::check($self); - hardware::server::dell::openmanage::mode::components::controller::check($self); - hardware::server::dell::openmanage::mode::components::connector::check($self); - - my $total_components = 0; - my $display_by_component = ''; - my $display_by_component_append = ''; - foreach my $comp (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 %s components [%s] are ok - Product Name: %s", - $total_components, - $display_by_component, - $self->{product_name}) - ); -} - -sub globalstatus { - my %status = ( - 1 => ['other', 'CRITICAL'], - 2 => ['unknown', 'UNKNOWN'], - 3 => ['ok', 'OK'], - 4 => ['nonCritical', 'WARNING'], - 5 => ['critical', 'CRITICAL'], - 6 => ['nonRecoverable', 'CRITICAL'], - ); - - my ($self) = @_; - - $self->{output}->output_add(long_msg => "Checking global system status"); - return if ($self->check_exclude('globalstatus')); - - my $oid_globalSystemStatus = '.1.3.6.1.4.1.674.10892.1.200.10.1.2.1'; - my $result = $self->{snmp}->get_leef(oids => [$oid_globalSystemStatus], nothing_quit => 1); - - $self->{output}->output_add(long_msg => sprintf("Overall global status is '%s'.", - ${$status{$result->{$oid_globalSystemStatus}}}[0] - )); - - $self->{output}->output_add(severity => ${$status{$result->{$oid_globalSystemStatus}}}[1], - short_msg => sprintf("Overall global status is '%s'", - ${$status{$result->{$oid_globalSystemStatus}}}[0])); -} - -sub component { - my ($self, %options) = @_; - - if ($self->{option_results}->{component} eq 'globalstatus') { - hardware::server::dell::openmanage::mode::components::globalstatus::check($self); - } elsif ($self->{option_results}->{component} eq 'fan') { - hardware::server::dell::openmanage::mode::components::fan::check($self); - } elsif ($self->{option_results}->{component} eq 'psu') { - hardware::server::dell::openmanage::mode::components::psu::check($self); - } elsif ($self->{option_results}->{component} eq 'temperature') { - hardware::server::dell::openmanage::mode::components::temperature::check($self); - } elsif ($self->{option_results}->{component} eq 'cpu') { - hardware::server::dell::openmanage::mode::components::cpu::check($self); - } elsif ($self->{option_results}->{component} eq 'cachebattery') { - hardware::server::dell::openmanage::mode::components::cachebattery::check($self); - } elsif ($self->{option_results}->{component} eq 'memory') { - hardware::server::dell::openmanage::mode::components::memory::check($self); - } elsif ($self->{option_results}->{component} eq 'physicaldisk') { - hardware::server::dell::openmanage::mode::components::physicaldisk::check($self); - } elsif ($self->{option_results}->{component} eq 'logicaldrive') { - hardware::server::dell::openmanage::mode::components::logicaldrive::check($self); - } elsif ($self->{option_results}->{component} eq 'esmlog') { - hardware::server::dell::openmanage::mode::components::esmlog::check($self); - } elsif ($self->{option_results}->{component} eq 'battery') { - hardware::server::dell::openmanage::mode::components::battery::check($self); - } elsif ($self->{option_results}->{component} eq 'controller') { - hardware::server::dell::openmanage::mode::components::controller::check($self); - } elsif ($self->{option_results}->{component} eq 'connector') { - hardware::server::dell::openmanage::mode::components::connector::check($self); - } elsif ($self->{option_results}->{component} eq 'storage') { - hardware::server::dell::openmanage::mode::components::physicaldisk::check($self); - hardware::server::dell::openmanage::mode::components::logicaldrive::check($self); - hardware::server::dell::openmanage::mode::components::cachebattery::check($self); - hardware::server::dell::openmanage::mode::components::controller::check($self); - hardware::server::dell::openmanage::mode::components::connector::check($self); - hardware::server::dell::openmanage::mode::components::cachebattery::check($self); - }else { - $self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'."); - $self->{output}->option_exit(); - } - - 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 %s components [%s] are ok.", - $total_components, - $display_by_component) - ); -} - -sub run { - my ($self, %options) = @_; - # $options{snmp} = snmp object - $self->{snmp} = $options{snmp}; - - if ($self->{option_results}->{component} eq 'all') { - $self->global(); - } elsif ($self->{option_results}->{component} eq 'globalstatus') { - $self->globalstatus(); - } else { - $self->component(); - } - - $self->{output}->display(); - $self->{output}->exit(); -} - -sub get_system_information { - my ($self) = @_; - - # In '10892-MIB' - my $oid_chassisModelName = ".1.3.6.1.4.1.674.10892.1.300.10.1.9.1"; - - my $result = $self->{snmp}->get_leef(oids => [$oid_chassisModelName]); - - $self->{product_name} = defined($result->{$oid_chassisModelName}) ? centreon::plugins::misc::trim($result->{$oid_chassisModelName}) : 'unknown'; -} - -sub check_exclude { - my ($self, $section) = @_; - - if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)$section(\s|,|$)/) { - $self->{output}->output_add(long_msg => sprintf("Skipping $section section.")); - return 1; - } - return 0; -} - -1; - -__END__ - -=head1 MODE - -Check Hardware (Global status, Fans, CPUs, Power Supplies, Temperature, Storage). - -=over 8 - -=item B<--component> - -Which component to check (Default: 'all'). -Can be: 'globalstatus', 'fan', 'cpu', 'psu', 'temperature', 'cachebattery', 'physicaldisk', 'logicaldrive', 'battery', 'controller', 'connector', 'storage'. - -=item B<--exclude> - -Exclude some parts (comma seperated list) (Example: --exclude=psu,fan). - -=back - -=cut - diff --git a/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/battery.pm b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/battery.pm new file mode 100644 index 000000000..7dfc1e12d --- /dev/null +++ b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/battery.pm @@ -0,0 +1,83 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# 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::server::dell::openmanage::snmp::mode::components::battery; + +use strict; +use warnings; + +my %map_status = ( + 1 => 'other', + 2 => 'unknown', + 3 => 'ok', + 4 => 'nonCritical', + 5 => 'critical', + 6 => 'nonRecoverable', +); + +my %map_reading = ( + 1 => 'Predictive Failure', + 2 => 'Failed', + 4 => 'Presence Detected', +); + +# In MIB '10892.mib' +my $mapping = { + batteryStatus => { oid => '.1.3.6.1.4.1.674.10892.1.600.50.1.5', map => \%map_status }, + batteryReading => { oid => '.1.3.6.1.4.1.674.10892.1.600.50.1.6', map => \%map_reading }, + batteryLocationName => { oid => '.1.3.6.1.4.1.674.10892.1.600.50.1.7' }, +}; +my $oid_batteryTableEntry = '.1.3.6.1.4.1.674.10892.1.600.50.1'; + +sub load { + my (%options) = @_; + + push @{$options{request}}, { oid => $oid_batteryTableEntry, start => $mapping->{globalSystemStatus}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking batteries"); + $self->{components}->{battery} = {name => 'batteries', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'battery')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_batteryTableEntry}})) { + next if ($oid !~ /^$mapping->{batteryStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_batteryTableEntry}, instance => $instance); + + next if ($self->check_exclude(section => 'battery', instance => $instance)); + + $self->{components}->{battery}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Battery '%s' status is '%s' [instance: %s, reading: %s, location: %s]", + $instance, $result->{batteryStatus}, $instance, $result->{batteryReading}, $result->{batteryLocationName} + )); + my $exit = $self->get_severity(section => 'battery', value => $result->{batteryStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Battery '%s' status is '%s'", + $instance, $result->{batteryStatus})); + } + } +} + +1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/cachebattery.pm b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/cachebattery.pm new file mode 100644 index 000000000..e2fa7e458 --- /dev/null +++ b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/cachebattery.pm @@ -0,0 +1,113 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# 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::server::dell::openmanage::snmp::mode::components::cachebattery; + +use strict; +use warnings; + +my %map_state = ( + 0 => 'unknown', + 1 => 'ready', + 2 => 'failed', + 6 => 'degraded', + 7 => 'reconditioning', + 9 => 'high', + 10 => 'powerLow', + 12 => 'charging', + 21 => 'missing', + 36 => 'learning', +); +my %map_status = ( + 1 => 'other', + 2 => 'unknown', + 3 => 'ok', + 4 => 'nonCritical', + 5 => 'critical', + 6 => 'nonRecoverable', +); +my %map_learnState = ( + 1 => 'failed', + 2 => 'active', + 4 => 'timedOut', + 8 => 'requested', + 16 => 'idle', + 32 => 'due', +); +my %map_predictedCapacity = ( + 1 => 'failed', + 2 => 'ready', + 4 => 'unknown', +); + +# In MIB 'dcstorag.mib' +my $mapping = { + batteryState => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.15.1.4', map => \%map_state }, +}; +my $mapping2 = { + batteryComponentStatus => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.15.1.6', map => \%map_status }, +}; +my $mapping3 = { + batteryPredictedCapicity => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.15.1.10', map => \%map_predictedCapacity }, +}; +my $mapping4 = { + batteryLearnState => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.15.1.12', map => \%map_learnState }, +}; + +sub load { + my (%options) = @_; + + push @{$options{request}}, { oid => $mapping->{batteryState}->{oid} }, { oid => $mapping2->{batteryComponentStatus}->{oid} }, + { oid => $mapping3->{batteryPredictedCapicity}->{oid} }, { oid => $mapping4->{batteryLearnState}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking cache batteries"); + $self->{components}->{cachebattery} = {name => 'cache batteries', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'cachebattery')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping2->{batteryComponentStatus}->{oid}}})) { + next if ($oid !~ /^$mapping2->{batteryComponentStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{batteryState}->{oid}}, instance => $instance); + my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$mapping2->{batteryComponentStatus}->{oid}}, instance => $instance); + my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$mapping3->{batteryPredictedCapicity}->{oid}}, instance => $instance); + my $result4 = $self->{snmp}->map_instance(mapping => $mapping4, results => $self->{results}->{$mapping4->{batteryLearnState}->{oid}}, instance => $instance); + + next if ($self->check_exclude(section => 'cachebattery', instance => $instance)); + + $self->{components}->{cachebattery}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Cache battery '%s' status is '%s' [instance: %s, state: %s, learn state: %s, predicted capacity: %s]", + $instance, $result2->{batteryComponentStatus}, $instance, + $result->{batteryState}, $result4->{batteryLearnState}, $result3->{batteryPredictedCapicity} + )); + my $exit = $self->get_severity(section => 'cachebattery', value => $result2->{batteryComponentStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Cache battery '%s' status is '%s'", + $instance, $result2->{batteryComponentStatus})); + } + } +} + +1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/connector.pm b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/connector.pm new file mode 100644 index 000000000..00bfeea2b --- /dev/null +++ b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/connector.pm @@ -0,0 +1,104 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# 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::server::dell::openmanage::snmp::mode::components::connector; + +use strict; +use warnings; + +my %map_state = ( + 0 => 'unknown', + 1 => 'ready', + 2 => 'failed', + 3 => 'online', + 4 => 'offline', + 6 => 'degraded', +); +my %map_status = ( + 1 => 'other', + 2 => 'unknown', + 3 => 'ok', + 4 => 'nonCritical', + 5 => 'critical', + 6 => 'nonRecoverable', +); +my %map_busType = ( + 1 => 'SCSI', + 2 => 'IDE', + 3 => 'Fibre Channel', + 4 => 'SSA', + 6 => 'USB', + 7 => 'SATA', + 8 => 'SAS', +); + +# In MIB 'dcstorag.mib' +my $mapping = { + channelName => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.2.1.2' }, + channelState => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.2.1.3', map => \%map_state }, +}; +my $mapping2 = { + channelComponentStatus => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.2.1.8', map => \%map_status }, +}; +my $mapping3 = { + channelBusType => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.2.1.11', map => \%map_busType }, +}; +my $oid_batteryEntry = '.1.3.6.1.4.1.674.10893.1.20.130.15.1'; + +sub load { + my (%options) = @_; + + push @{$options{request}}, { oid => $oid_batteryEntry, start => $mapping->{channelName}->{oid}, end => $mapping->{channelState}->{oid} }, + { oid => $mapping2->{channelComponentStatus}->{oid} }, + { oid => $mapping3->{channelBusType}->{oid} } ; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking connectors (channels)"); + $self->{components}->{connector} = {name => 'connectors', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'connector')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping2->{channelComponentStatus}->{oid}}})) { + next if ($oid !~ /^$mapping2->{channelComponentStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_batteryEntry}, instance => $instance); + my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$mapping2->{channelComponentStatus}->{oid}}, instance => $instance); + my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$mapping3->{channelBusType}->{oid}}, instance => $instance); + + next if ($self->check_exclude(section => 'connector', instance => $instance)); + + $self->{components}->{connector}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Connector '%s' status is '%s' [instance: %s, state: %s, bus type: %s]", + $result->{channelName}, $result2->{channelComponentStatus}, $instance, + $result->{channelState}, $result3->{channelBusType} + )); + my $exit = $self->get_severity(section => 'connector', value => $result2->{channelComponentStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Connector '%s' status is '%s'", + $result->{channelName}, $result2->{channelComponentStatus})); + } + } +} + +1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/controller.pm b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/controller.pm new file mode 100644 index 000000000..f05e37e83 --- /dev/null +++ b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/controller.pm @@ -0,0 +1,96 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# 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::server::dell::openmanage::snmp::mode::components::controller; + +use strict; +use warnings; + +my %map_state = ( + 0 => 'unknown', + 1 => 'ready', + 2 => 'failed', + 3 => 'online', + 4 => 'offline', + 6 => 'degraded', +); +my %map_status = ( + 1 => 'other', + 2 => 'unknown', + 3 => 'ok', + 4 => 'nonCritical', + 5 => 'critical', + 6 => 'nonRecoverable', +); + +# In MIB 'dcstorag.mib' +my $mapping = { + controllerName => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.1.1.2' }, +}; +my $mapping2 = { + controllerComponentStatus => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.1.1.38', map => \%map_status }, +}; +my $mapping3 = { + controllerState => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.1.1.5', map => \%map_state }, +}; +my $mapping4 = { + controllerFWVersion => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.1.1.8' }, +}; + +sub load { + my (%options) = @_; + + push @{$options{request}}, { oid => $mapping->{controllerName}->{oid} }, { oid => $mapping2->{controllerComponentStatus}->{oid} }, + { oid => $mapping3->{controllerState}->{oid} }, { oid => $mapping4->{controllerFWVersion}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking controllers"); + $self->{components}->{controller} = {name => 'controllers', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'controller')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping2->{controllerComponentStatus}->{oid}}})) { + next if ($oid !~ /^$mapping2->{controllerComponentStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{controllerName}->{oid}}, instance => $instance); + my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$mapping2->{controllerComponentStatus}->{oid}}, instance => $instance); + my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$mapping3->{controllerState}->{oid}}, instance => $instance); + my $result4 = $self->{snmp}->map_instance(mapping => $mapping4, results => $self->{results}->{$mapping4->{controllerFWVersion}->{oid}}, instance => $instance); + + next if ($self->check_exclude(section => 'controller', instance => $instance)); + + $self->{components}->{controller}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Controller '%s' status is '%s' [instance: %s, state: %s, firmware: %s]", + $result->{controllerName}, $result2->{controllerComponentStatus}, $instance, + $result3->{controllerState}, $result4->{controllerFWVersion} + )); + my $exit = $self->get_severity(section => 'controller', value => $result2->{controllerComponentStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Controller '%s' status is '%s'", + $result->{controllerName}, $result2->{controllerComponentStatus})); + } + } +} + +1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/cpu.pm b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/cpu.pm new file mode 100644 index 000000000..2a8bce470 --- /dev/null +++ b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/cpu.pm @@ -0,0 +1,100 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# 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::server::dell::openmanage::snmp::mode::components::cpu; + +use strict; +use warnings; + +my %map_status = ( + 1 => 'other', + 2 => 'unknown', + 3 => 'ok', + 4 => 'nonCritical', + 5 => 'critical', + 6 => 'nonRecoverable', +); +my %map_statusState = ( + 1 => 'other', + 2 => 'unknown', + 3 => 'enabled', + 4 => 'userDisabled', + 5 => 'biosDisabled', + 6 => 'idle', +); + +# In MIB '10892.mib' +my $mapping = { + processorDeviceStatus => { oid => '.1.3.6.1.4.1.674.10892.1.1100.30.1.5', map => \%map_status }, +}; +my $mapping2 = { + processorDeviceManufacturerName => { oid => '.1.3.6.1.4.1.674.10892.1.1100.30.1.8' }, + processorDeviceStatusState => { oid => '.1.3.6.1.4.1.674.10892.1.1100.30.1.9', map => \%map_statusState }, +}; +my $mapping3 = { + processorDeviceCurrentSpeed => { oid => '.1.3.6.1.4.1.674.10892.1.1100.30.1.12' }, # in mHz +}; +my $mapping4 = { + processorDeviceBrandName => { oid => '.1.3.6.1.4.1.674.10892.1.1100.30.1.23' }, +}; +my $oid_processorDeviceTableEntry = '.1.3.6.1.4.1.674.10892.1.1100.30.1'; + +sub load { + my (%options) = @_; + + push @{$options{request}}, { oid => $mapping->{processorDeviceStatus}->{oid} }, + { oid => $oid_processorDeviceTableEntry, start => $mapping2->{processorDeviceManufacturerName}->{oid}, end => $mapping2->{processorDeviceStatusState}->{oid} }, + { oid => $mapping3->{processorDeviceCurrentSpeed}->{oid} }, { oid => $mapping4->{processorDeviceBrandName}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking processor units"); + $self->{components}->{cpu} = {name => 'CPUs', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'cpu')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{processorDeviceStatus}->{oid}}})) { + next if ($oid !~ /^$mapping->{processorDeviceStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{processorDeviceStatus}->{oid}}, instance => $instance); + my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_processorDeviceTableEntry}, instance => $instance); + my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$mapping3->{processorDeviceCurrentSpeed}->{oid}}, instance => $instance); + my $result4 = $self->{snmp}->map_instance(mapping => $mapping4, results => $self->{results}->{$mapping4->{processorDeviceBrandName}->{oid}}, instance => $instance); + + next if ($self->check_exclude(section => 'cpu', instance => $instance)); + + $self->{components}->{cpu}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Cpu '%s' status is '%s' [instance: %s, manufacturer name: %s, brand name: %s, state: %s, speed: %s]", + $instance, $result->{processorDeviceStatus}, $instance, + $result2->{processorDeviceManufacturerName}, $result4->{processorDeviceBrandName}, + $result2->{processorDeviceStatusState}, $result3->{processorDeviceCurrentSpeed} + )); + my $exit = $self->get_severity(section => 'cpu', value => $result->{processorDeviceStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Cpu '%s' status is '%s'", + $instance, $result->{processorDeviceStatus})); + } + } +} + +1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/esmlog.pm b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/esmlog.pm new file mode 100644 index 000000000..da6ff2475 --- /dev/null +++ b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/esmlog.pm @@ -0,0 +1,74 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# 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::server::dell::openmanage::snmp::mode::components::esmlog; + +use strict; +use warnings; + +my %map_status = ( + 1 => 'other', + 2 => 'unknown', + 3 => 'ok', + 4 => 'nonCritical', + 5 => 'critical', + 6 => 'nonRecoverable', +); + +# In MIB '10892.mib' +my $mapping = { + systemStateEventLogStatus => { oid => '.1.3.6.1.4.1.674.10892.1.200.10.1.41', map => \%map_status }, +}; + +sub load { + my (%options) = @_; + + push @{$options{request}}, { oid => $mapping->{systemStateEventLogStatus}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking ESM log filling"); + $self->{components}->{esmlog} = {name => 'ESM log', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'esmlog')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{systemStateEventLogStatus}->{oid}}})) { + next if ($oid !~ /^$mapping->{systemStateEventLogStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{systemStateEventLogStatus}->{oid}}, instance => $instance); + + next if ($self->check_exclude(section => 'globalstatus', instance => $instance)); + + $self->{components}->{esmlog}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("ESM '%s' log status is '%s' [instance: %s]", + $instance, $result->{systemStateEventLogStatus}, $instance + )); + my $exit = $self->get_severity(section => 'esmlog', value => $result->{systemStateEventLogStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("ESM '%s' log status is '%s'", + $instance, $result->{systemStateEventLogStatus})); + } + } +} + +1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/fan.pm b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/fan.pm new file mode 100644 index 000000000..6bec70c6f --- /dev/null +++ b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/fan.pm @@ -0,0 +1,121 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# 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::server::dell::openmanage::snmp::mode::components::fan; + +use strict; +use warnings; + +my %map_status = ( + 1 => 'other', + 2 => 'unknown', + 3 => 'ok', + 4 => 'nonCriticalUpper', + 5 => 'criticalUpper', + 6 => 'nonRecoverableUpper', + 7 => 'nonCriticalLower', + 8 => 'criticalLower', + 9 => 'nonRecoverableLower', + 10 => 'failed', +); + +# In MIB '10892.mib' +my $mapping = { + coolingDeviceStatus => { oid => '.1.3.6.1.4.1.674.10892.1.700.12.1.5', map => \%map_status }, + coolingDeviceReading => { oid => '.1.3.6.1.4.1.674.10892.1.700.12.1.6' }, +}; +my $mapping2 = { + coolingDeviceLocationName => { oid => '.1.3.6.1.4.1.674.10892.1.700.12.1.8' }, +}; +my $mapping3 = { + coolingDeviceUpperCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.1.700.12.1.10' }, + coolingDeviceUpperNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.1.700.12.1.11' }, + coolingDeviceLowerNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.1.700.12.1.12' }, + coolingDeviceLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.1.700.12.1.13' }, +}; +my $oid_coolingDeviceTable = '.1.3.6.1.4.1.674.10892.1.700.12'; +my $oid_coolingDeviceTableEntry = '.1.3.6.1.4.1.674.10892.1.700.12.1'; + +sub load { + my (%options) = @_; + + push @{$options{request}}, { oid => $oid_coolingDeviceTableEntry, start => $mapping->{coolingDeviceStatus}->{oid}, end => $mapping->{coolingDeviceReading}->{oid} }, + { oid => $mapping2->{coolingDeviceLocationName}->{oid} }, + { oid => $oid_coolingDeviceTable, start => $mapping3->{coolingDeviceUpperCriticalThreshold}->{oid}, end => $mapping3->{coolingDeviceLowerCriticalThreshold}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking fans"); + $self->{components}->{fan} = {name => 'fans', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'fan')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_coolingDeviceTableEntry}})) { + next if ($oid !~ /^$mapping->{coolingDeviceStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_coolingDeviceTableEntry}, instance => $instance); + my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$mapping2->{coolingDeviceLocationName}->{oid}}, instance => $instance); + my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$oid_coolingDeviceTable}, instance => $instance); + + next if ($self->check_exclude(section => 'fan', instance => $instance)); + + $self->{components}->{fan}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Fan '%s' status is '%s' [instance: %s, Location: %s, reading: %s]", + $instance, $result->{coolingDeviceStatus}, $instance, + $result2->{coolingDeviceLocationName}, $result->{coolingDeviceReading} + )); + my $exit = $self->get_severity(section => 'fan', value => $result->{coolingDeviceStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Fan '%s' status is '%s'", + $instance, $result->{coolingDeviceStatus})); + } + + if (defined($result->{coolingDeviceReading}) && $result->{coolingDeviceReading} =~ /[0-9]/) { + my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, value => $result->{coolingDeviceReading}); + if ($checked == 0) { + my $warn_th = $result->{coolingDeviceLowerNonCriticalThreshold} . ':' . $result->{coolingDeviceUpperNonCriticalThreshold}; + my $crit_th = $result->{coolingDeviceLowerCriticalThreshold} . ':' . $result->{coolingDeviceUpperCriticalThreshold}; + $self->{perfdata}->threshold_validate(label => 'warning-fan-instance-' . $instance, value => $warn_th); + $self->{perfdata}->threshold_validate(label => 'critical-fan-instance-' . $instance, value => $crit_th); + + $exit = $self->{perfdata}->threshold_check(value => $result->{coolingDeviceReading}, threshold => [ { label => 'critical-fan-instance-' . $instance, exit_litteral => 'critical' }, + { label => 'warning-fan-instance-' . $instance, exit_litteral => 'warning' } ]); + $warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-fan-instance-' . $instance); + $crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-fan-instance-' . $instance); + } + + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Fan '%s' speed is %s rpm", $instance, $result->{coolingDeviceReading})); + } + $self->{output}->perfdata_add(label => 'fan_' . $instance, unit => 'rpm', + value => $result->{coolingDeviceReading}, + warning => $warn, + critical => $crit, + min => 0 + ); + } + } +} + +1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/globalstatus.pm b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/globalstatus.pm new file mode 100644 index 000000000..aee0ebb5d --- /dev/null +++ b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/globalstatus.pm @@ -0,0 +1,74 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# 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::server::dell::openmanage::snmp::mode::components::globalstatus; + +use strict; +use warnings; + +my %map_status = ( + 1 => 'other', + 2 => 'unknown', + 3 => 'ok', + 4 => 'nonCritical', + 5 => 'critical', + 6 => 'nonRecoverable', +); + +# In MIB '10892.mib' +my $mapping = { + globalSystemStatus => { oid => '.1.3.6.1.4.1.674.10892.1.200.10.1.2', map => \%map_status }, +}; + +sub load { + my (%options) = @_; + + push @{$options{request}}, { oid => $mapping->{globalSystemStatus}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking global system status"); + $self->{components}->{globalstatus} = {name => 'global system status', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'globalstatus')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{globalSystemStatus}->{oid}}})) { + next if ($oid !~ /^$mapping->{globalSystemStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{globalSystemStatus}->{oid}}, instance => $instance); + + next if ($self->check_exclude(section => 'globalstatus', instance => $instance)); + + $self->{components}->{globalstatus}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Chassis '%s' global status is '%s' [instance: %s]", + $instance, $result->{globalSystemStatus}, $instance + )); + my $exit = $self->get_severity(section => 'globalstatus', value => $result->{globalSystemStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Chassis '%s' global status is '%s'", + $instance, $result->{globalSystemStatus})); + } + } +} + +1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/logicaldrive.pm b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/logicaldrive.pm new file mode 100644 index 000000000..81bb675ad --- /dev/null +++ b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/logicaldrive.pm @@ -0,0 +1,126 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# 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::server::dell::openmanage::snmp::mode::components::logicaldrive; + +use strict; +use warnings; + +my %map_state = ( + 0 => 'unknown', + 1 => 'ready', + 2 => 'failed', + 3 => 'online', + 4 => 'offline', + 6 => 'degraded', + 15 => 'resynching', + 24 => 'rebuild', + 26 => 'formatting', + 35 => 'initializing', +); +my %map_layout = ( + 1 => 'Concatened', + 2 => 'RAID-0', + 3 => 'RAID-1', + 4 => 'RAID-2', + 5 => 'RAID-3', + 6 => 'RAID-4', + 7 => 'RAID-5', + 8 => 'RAID-6', + 9 => 'RAID-7', + 10 => 'RAID-10', + 11 => 'RAID-30', + 12 => 'RAID-50', + 13 => 'Add spares', + 14 => 'Delete logical', + 15 => 'Transform logical', + 18 => 'RAID-0-plus-1 - Mylex only', + 19 => 'Concatened RAID 1', + 20 => 'Concatened RAID 5', + 21 => 'no RAID', + 22 => 'RAID Morph - Adapted only', +); +my %map_status = ( + 1 => 'other', + 2 => 'unknown', + 3 => 'ok', + 4 => 'nonCritical', + 5 => 'critical', + 6 => 'nonRecoverable', +); + +# In MIB 'dcstorag.mib' +my $mapping = { + virtualDiskName => { oid => '.1.3.6.1.4.1.674.10893.1.20.140.1.1.2' }, + virtualDiskDeviceName => { oid => '.1.3.6.1.4.1.674.10893.1.20.140.1.1.3' }, + virtualDiskState => { oid => '.1.3.6.1.4.1.674.10893.1.20.140.1.1.4', map => \%map_state }, +}; +my $mapping2 = { + virtualDiskLengthInMB => { oid => '.1.3.6.1.4.1.674.10893.1.20.140.1.1.6' }, +}; +my $mapping3 = { + virtualDiskLayout => { oid => '.1.3.6.1.4.1.674.10893.1.20.140.1.1.13', map => \%map_layout }, +}; +my $mapping4 = { + virtualDiskComponentStatus => { oid => '.1.3.6.1.4.1.674.10893.1.20.140.1.1.20', map => \%map_status }, +}; +my $oid_virtualDiskEntry = '.1.3.6.1.4.1.674.10893.1.20.140.1.1'; + +sub load { + my (%options) = @_; + + push @{$options{request}}, { oid => $oid_virtualDiskEntry, start => $mapping->{virtualDiskName}->{oid}, end => $mapping->{virtualDiskState}->{oid} }, + { oid => $mapping2->{virtualDiskLengthInMB}->{oid} }, { oid => $mapping3->{virtualDiskLayout}->{oid} }, { oid => $mapping4->{virtualDiskComponentStatus}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking logical drives"); + $self->{components}->{logicaldrive} = {name => 'logical drives', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'logicaldrive')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping4->{virtualDiskComponentStatus}->{oid}}})) { + next if ($oid !~ /^$mapping4->{virtualDiskComponentStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_virtualDiskEntry}, instance => $instance); + my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$mapping2->{virtualDiskLengthInMB}->{oid}}, instance => $instance); + my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$mapping3->{virtualDiskLayout}->{oid}}, instance => $instance); + my $result4 = $self->{snmp}->map_instance(mapping => $mapping4, results => $self->{results}->{$mapping4->{virtualDiskComponentStatus}->{oid}}, instance => $instance); + + next if ($self->check_exclude(section => 'logicaldrive', instance => $instance)); + + $self->{components}->{logicaldrive}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Logical drive '%s' status is '%s' [instance: %s, size: %s MB, layout: %s, state: %s, device name: %s]", + $result->{virtualDiskName}, $result4->{virtualDiskComponentStatus}, $instance, + $result2->{virtualDiskLengthInMB}, $result3->{virtualDiskLayout}, + $result->{virtualDiskState}, $result->{virtualDiskDeviceName} + )); + my $exit = $self->get_severity(section => 'logicaldrive', value => $result4->{virtualDiskComponentStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Logical drive '%s' status is '%s'", + $result->{virtualDiskName}, $result4->{virtualDiskComponentStatus})); + } + } +} + +1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/memory.pm b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/memory.pm new file mode 100644 index 000000000..120e2017f --- /dev/null +++ b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/memory.pm @@ -0,0 +1,97 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# 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::server::dell::openmanage::snmp::mode::components::memory; + +use strict; +use warnings; + +my %map_status = ( + 1 => 'other', + 2 => 'unknown', + 3 => 'ok', + 4 => 'nonCritical', + 5 => 'critical', + 6 => 'nonRecoverable', +); +my %map_failureModes = ( + 0 => 'Not failure', + 1 => 'ECC single bit correction warning rate exceeded', + 2 => 'ECC single bit correction failure rate exceeded', + 4 => 'ECC multibit fault encountered', + 8 => 'ECC single bit correction logging disabled', + 16 => 'device disabled because of spare activation', +); + +# In MIB '10892.mib' +my $mapping = { + memoryDeviceStatus => { oid => '.1.3.6.1.4.1.674.10892.1.1100.50.1.5', map => \%map_status }, +}; +my $mapping2 = { + memoryDeviceLocationName => { oid => '.1.3.6.1.4.1.674.10892.1.1100.50.1.8' }, +}; +my $mapping3 = { + memoryDeviceSize => { oid => '.1.3.6.1.4.1.674.10892.1.1100.50.1.14' }, +}; +my $mapping4 = { + memoryDeviceFailureModes => { oid => '.1.3.6.1.4.1.674.10892.1.1100.50.1.20', map => \%map_failureModes }, +}; + +sub load { + my (%options) = @_; + + push @{$options{request}}, { oid => $mapping->{memoryDeviceStatus}->{oid} }, { oid => $mapping2->{memoryDeviceLocationName}->{oid} }, + { oid => $mapping3->{memoryDeviceSize}->{oid} }, { oid => $mapping4->{memoryDeviceFailureModes}->{oid} }; +} + + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking memory modules"); + $self->{components}->{memory} = {name => 'memory modules', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'memory')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping->{memoryDeviceStatus}->{oid}}})) { + next if ($oid !~ /^$mapping->{memoryDeviceStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{memoryDeviceStatus}->{oid}}, instance => $instance); + my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$mapping2->{memoryDeviceLocationName}->{oid}}, instance => $instance); + my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$mapping3->{memoryDeviceSize}->{oid}}, instance => $instance); + my $result4 = $self->{snmp}->map_instance(mapping => $mapping4, results => $self->{results}->{$mapping4->{memoryDeviceFailureModes}->{oid}}, instance => $instance); + + next if ($self->check_exclude(section => 'memory', instance => $instance)); + + $self->{components}->{memory}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Memory module '%s' status is '%s' [instance: %s, Location: %s, Size: %s MB, Failure mode: %s]", + $instance, $result->{memoryDeviceStatus}, $instance, + $result2->{memoryDeviceLocationName}, $result3->{memoryDeviceSize}, $result4->{memoryDeviceFailureModes} + )); + my $exit = $self->get_severity(section => 'memory', value => $result->{memoryDeviceStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Memory module '%s' status is '%s'", + $instance, $result->{memoryDeviceStatus})); + } + } +} + +1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/physicaldisk.pm b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/physicaldisk.pm new file mode 100644 index 000000000..f6ec8acca --- /dev/null +++ b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/physicaldisk.pm @@ -0,0 +1,128 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# 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::server::dell::openmanage::snmp::mode::components::physicaldisk; + +use strict; +use warnings; + +my %map_state = ( + 0 => 'unknown', + 1 => 'ready', + 2 => 'failed', + 3 => 'online', + 4 => 'offline', + 6 => 'degraded', + 7 => 'recovering', + 11 => 'removed', + 15 => 'resynching', + 24 => 'rebuild', + 25 => 'noMedia', + 26 => 'formatting', + 28 => 'diagnostics', + 35 => 'initializing', +); +my %map_spareState = ( + 1 => 'memberVD', + 2 => 'memberDG', + 3 => 'globalHostSpare', + 4 => 'dedicatedHostSpare', + 5 => 'notASpare', +); +my %map_status = ( + 1 => 'other', + 2 => 'unknown', + 3 => 'ok', + 4 => 'nonCritical', + 5 => 'critical', + 6 => 'nonRecoverable', +); +my %map_smartAlertIndication = ( + 1 => 'no', + 2 => 'yes', +); + +# In MIB 'dcstorag.mib' +my $mapping = { + arrayDiskName => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.4.1.2' }, +}; +my $mapping2 = { + arrayDiskState => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.4.1.4', map => \%map_state }, +}; +my $mapping3 = { + arrayDiskSpareState => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.4.1.22', map => \%map_spareState }, +}; +my $mapping4 = { + arrayDiskComponentStatus => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.4.1.24', map => \%map_status }, +}; +my $mapping5 = { + arrayDiskSmartAlertIndication => { oid => '.1.3.6.1.4.1.674.10893.1.20.130.4.1.31', map => \%map_smartAlertIndication }, +}; + +sub load { + my (%options) = @_; + + push @{$options{request}}, { oid => $mapping->{arrayDiskName}->{oid} }, { oid => $mapping2->{arrayDiskState}->{oid} }, + { oid => $mapping3->{arrayDiskSpareState}->{oid} }, { oid => $mapping4->{arrayDiskComponentStatus}->{oid} }, + { oid => $mapping5->{arrayDiskSmartAlertIndication}->{oid} }; +} + + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking physical disks"); + $self->{components}->{physicaldisk} = {name => 'physical disks', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'physicaldisk')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$mapping4->{arrayDiskComponentStatus}->{oid}}})) { + next if ($oid !~ /^$mapping4->{arrayDiskComponentStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{arrayDiskName}->{oid}}, instance => $instance); + my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$mapping2->{arrayDiskState}->{oid}}, instance => $instance); + my $result3 = $self->{snmp}->map_instance(mapping => $mapping3, results => $self->{results}->{$mapping3->{arrayDiskSpareState}->{oid}}, instance => $instance); + my $result4 = $self->{snmp}->map_instance(mapping => $mapping4, results => $self->{results}->{$mapping4->{arrayDiskComponentStatus}->{oid}}, instance => $instance); + my $result5 = $self->{snmp}->map_instance(mapping => $mapping4, results => $self->{results}->{$mapping5->{arrayDiskSmartAlertIndication}->{oid}}, instance => $instance); + + next if ($self->check_exclude(section => 'physicaldisk', instance => $instance)); + + $self->{components}->{physicaldisk}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Physical Disk '%s' status is '%s' [instance: %s, state: %s, spare state: %s, smart alert: %s]", + $result->{arrayDiskName}, $result4->{arrayDiskComponentStatus}, $instance, + $result2->{arrayDiskState}, $result3->{arrayDiskSpareState}, $result5->{arrayDiskSmartAlertIndication} + )); + my $exit = $self->get_severity(section => 'physicaldisk', value => $result4->{arrayDiskComponentStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Physical Disk '%s' status is '%s'", + $result->{arrayDiskName}, $result4->{arrayDiskComponentStatus})); + } + + $exit = $self->get_severity(section => 'physicaldisk_smartalert', value => $result5->{arrayDiskSmartAlertIndication}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("physical disk '%s' has received a predictive failure alert", + $result->{arrayDiskName})); + } + } +} + +1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/psu.pm b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/psu.pm new file mode 100644 index 000000000..89ccf750c --- /dev/null +++ b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/psu.pm @@ -0,0 +1,130 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# 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::server::dell::openmanage::snmp::mode::components::psu; + +use strict; +use warnings; + +my %map_status = ( + 1 => 'other', + 2 => 'unknown', + 3 => 'ok', + 4 => 'nonCritical', + 5 => 'critical', + 6 => 'nonRecoverable', +); +my %map_type = ( + 1 => 'other', + 2 => 'unknown', + 3 => 'Linear', + 4 => 'switching', + 5 => 'Battery', + 6 => 'UPS', + 7 => 'Converter', + 8 => 'Regulator', + 9 => 'AC', + 10 => 'DC', + 11 => 'VRM', +); +my %map_state = ( + 1 => 'present', + 2 => 'failure', + 4 => 'predictiveFailure', + 8 => 'ACLost', + 16 => 'ACLostOrOutOfRange', + 32 => 'ACPresentButOutOfRange', + 64 => 'configurationError', +); +my %map_ConfigurationErrorType = ( + 1 => 'vendorMismatch', + 2 => 'revisionMismatch', + 3 => 'processorMissing', +); + +# In MIB '10892.mib' +my $mapping = { + powerSupplyStatus => { oid => '.1.3.6.1.4.1.674.10892.1.600.12.1.5', map => \%map_status }, + powerSupplyOutputWatts => { oid => '.1.3.6.1.4.1.674.10892.1.600.12.1.6' }, + powerSupplyType => { oid => '.1.3.6.1.4.1.674.10892.1.600.12.1.7', map => \%map_type }, + powerSupplyLocationName => { oid => '.1.3.6.1.4.1.674.10892.1.600.12.1.8' }, +}; +my $mapping2 = { + powerSupplySensorState => { oid => '.1.3.6.1.4.1.674.10892.1.600.12.1.11', map => \%map_state }, + powerSupplyConfigurationErrorType => { oid => '.1.3.6.1.4.1.674.10892.1.600.12.1.12', map => \%map_ConfigurationErrorType }, +}; +my $oid_powerSupplyTable = '.1.3.6.1.4.1.674.10892.1.600.12'; +my $oid_powerSupplyTableEntry = '.1.3.6.1.4.1.674.10892.1.600.12.1'; + +sub load { + my (%options) = @_; + + push @{$options{request}}, { oid => $oid_powerSupplyTable, start => $mapping->{powerSupplyStatus}->{oid}, end => $mapping->{powerSupplyLocationName}->{oid} }, + { oid => $oid_powerSupplyTableEntry, start => $mapping->{powerSupplySensorState}->{oid}, end => $mapping->{powerSupplyConfigurationErrorType}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking power supplies"); + $self->{components}->{psu} = {name => 'power supplies', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'psu')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_powerSupplyTable}})) { + next if ($oid !~ /^$mapping->{powerSupplyStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_powerSupplyTable}, instance => $instance); + my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_powerSupplyTableEntry}, instance => $instance); + + next if ($self->check_exclude(section => 'psu', instance => $instance)); + + $self->{components}->{psu}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is '%s' [instance: %s, location: %s, type: %s, output watts: %s, state: %s, configuration error: %s]", + $instance, $result->{powerSupplyStatus}, $instance, + $result->{powerSupplyLocationName}, $result->{powerSupplyType}, $result->{powerSupplyOutputWatts}, + $result2->{powerSupplySensorState}, $result2->{powerSupplyConfigurationErrorType} + )); + my $exit = $self->get_severity(section => 'psu', value => $result->{powerSupplyStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Power supply '%s' status is '%s'", + $instance, $result->{powerSupplyStatus})); + } + + if (defined($result->{powerSupplyOutputWatts}) && $result->{powerSupplyOutputWatts} =~ /[0-9]/) { + $result->{powerSupplyOutputWatts} *= 10; + my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'psu.power', instance => $instance, value => $result->{powerSupplyOutputWatts}); + + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Power supply '%s' power is %s W", $instance, $result->{powerSupplyOutputWatts})); + } + $self->{output}->perfdata_add(label => 'psu_power_' . $instance, unit => 'W', + value => $result->{powerSupplyOutputWatts}, + warning => $warn, + critical => $crit, + min => 0 + ); + } + } +} + +1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/temperature.pm b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/temperature.pm new file mode 100644 index 000000000..849d8eb5a --- /dev/null +++ b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/components/temperature.pm @@ -0,0 +1,125 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# 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::server::dell::openmanage::snmp::mode::components::temperature; + +use strict; +use warnings; + +my %map_status = ( + 1 => 'other', + 2 => 'unknown', + 3 => 'ok', + 4 => 'nonCriticalUpper', + 5 => 'criticalUpper', + 6 => 'nonRecoverableUpper', + 7 => 'nonCriticalLower', + 8 => 'criticalLower', + 9 => 'nonRecoverableLower', + 10 => 'failed', +); +my %map_type = ( + 1 => 'other', + 2 => 'unknown', + 3 => 'Ambient ESM', + 4 => 'Discrete', +); + +# In MIB '10892.mib' +my $mapping = { + temperatureProbeStatus => { oid => '.1.3.6.1.4.1.674.10892.1.700.20.1.5', map => \%map_status }, + temperatureProbeReading => { oid => '.1.3.6.1.4.1.674.10892.1.700.20.1.6' }, + temperatureProbeType => { oid => '.1.3.6.1.4.1.674.10892.1.700.20.1.7', map => \%map_type }, + temperatureProbeLocationName => { oid => '.1.3.6.1.4.1.674.10892.1.700.20.1.8' }, +}; +my $mapping2 = { + temperatureProbeUpperCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.1.700.20.1.10' }, + temperatureProbeUpperNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.1.700.20.1.11' }, + temperatureProbeLowerNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.1.700.20.1.12' }, + temperatureProbeLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.1.700.20.1.13' }, +}; +my $oid_temperatureProbeTable = '.1.3.6.1.4.1.674.10892.1.700.20'; +my $oid_temperatureProbeTableEntry = '.1.3.6.1.4.1.674.10892.1.700.20.1'; + +sub load { + my (%options) = @_; + + push @{$options{request}}, { oid => $oid_temperatureProbeTable, start => $mapping->{temperatureProbeStatus}->{oid}, end => $mapping->{temperatureProbeLocationName}->{oid} }, + { oid => $oid_temperatureProbeTableEntry, start => $mapping2->{temperatureProbeUpperCriticalThreshold}->{oid}, end => $mapping2->{temperatureProbeLowerCriticalThreshold}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking temperatures"); + $self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0}; + return if ($self->check_exclude(section => 'temperature')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_temperatureProbeTable}})) { + next if ($oid !~ /^$mapping->{temperatureProbeStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_temperatureProbeTable}, instance => $instance); + my $result2 = $self->{snmp}->map_instance(mapping => $mapping2, results => $self->{results}->{$oid_temperatureProbeTableEntry}, instance => $instance); + + next if ($self->check_exclude(section => 'temperature', instance => $instance)); + + $self->{components}->{temperature}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Temperature '%s' status is '%s' [instance: %s, location: %s, reading: %s]", + $instance, $result->{temperatureProbeStatus}, $instance, + $result->{temperatureProbeLocationName}, $result->{temperatureProbeReading} + )); + my $exit = $self->get_severity(section => 'temperature', value => $result->{temperatureProbeStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Temperature '%s' status is '%s'", + $instance, $result->{temperatureProbeStatus})); + } + + if (defined($result->{temperatureProbeReading}) && $result->{temperatureProbeReading} =~ /[0-9]/) { + $result->{temperatureProbeReading} *= 10; + my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{temperatureProbeReading}); + if ($checked == 0) { + my $warn_th = $result->{temperatureProbeLowerNonCriticalThreshold} . ':' . $result->{temperatureProbeUpperNonCriticalThreshold}; + my $crit_th = $result->{temperatureProbeLowerCriticalThreshold} . ':' . $result->{temperatureProbeUpperCriticalThreshold}; + $self->{perfdata}->threshold_validate(label => 'warning-temperature-instance-' . $instance, value => $warn_th); + $self->{perfdata}->threshold_validate(label => 'critical-temperature-instance-' . $instance, value => $crit_th); + + $exit = $self->{perfdata}->threshold_check(value => $result->{temperatureProbeReading}, threshold => [ { label => 'critical-temperature-instance-' . $instance, exit_litteral => 'critical' }, + { label => 'warning-temperature-instance-' . $instance, exit_litteral => 'warning' } ]); + $warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-temperature-instance-' . $instance); + $crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $instance); + } + + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Temperature '%s' is %s degree centigrade", $instance, $result->{temperatureProbeReading})); + } + $self->{output}->perfdata_add(label => 'temp_' . $instance, unit => 'C', + value => $result->{temperatureProbeReading}, + warning => $warn, + critical => $crit, + min => 0 + ); + } + } +} + +1; diff --git a/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/hardware.pm b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/hardware.pm new file mode 100644 index 000000000..2e120f91c --- /dev/null +++ b/centreon-plugins/hardware/server/dell/openmanage/snmp/mode/hardware.pm @@ -0,0 +1,401 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# 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::server::dell::openmanage::snmp::mode::hardware; + +use base qw(centreon::plugins::mode); + +use strict; +use warnings; +use centreon::plugins::misc; + +my $thresholds = { + globalstatus => [ + ['other', 'CRITICAL'], + ['unknown', 'UNKNOWN'], + ['ok', 'OK'], + ['nonCritical', 'WARNING'], + ['critical', 'CRITICAL'], + ['nonRecoverable', 'CRITICAL'], + ], + battery => [ + ['other', 'CRITICAL'], + ['unknown', 'UNKNOWN'], + ['ok', 'OK'], + ['nonCritical', 'WARNING'], + ['critical', 'CRITICAL'], + ['nonRecoverable', 'CRITICAL'], + ], + cachebattery => [ + ['other', 'CRITICAL'], + ['unknown', 'UNKNOWN'], + ['ok', 'OK'], + ['nonCritical', 'WARNING'], + ['critical', 'CRITICAL'], + ['nonRecoverable', 'CRITICAL'], + ], + connector => [ + ['other', 'CRITICAL'], + ['unknown', 'UNKNOWN'], + ['ok', 'OK'], + ['nonCritical', 'WARNING'], + ['critical', 'CRITICAL'], + ['nonRecoverable', 'CRITICAL'], + ], + controller => [ + ['other', 'CRITICAL'], + ['unknown', 'UNKNOWN'], + ['ok', 'OK'], + ['nonCritical', 'WARNING'], + ['critical', 'CRITICAL'], + ['nonRecoverable', 'CRITICAL'], + ], + controller => [ + ['other', 'CRITICAL'], + ['unknown', 'UNKNOWN'], + ['ok', 'OK'], + ['nonCritical', 'WARNING'], + ['critical', 'CRITICAL'], + ['nonRecoverable', 'CRITICAL'], + ], + cpu => [ + ['other', 'CRITICAL'], + ['unknown', 'UNKNOWN'], + ['ok', 'OK'], + ['nonCritical', 'WARNING'], + ['critical', 'CRITICAL'], + ['nonRecoverable', 'CRITICAL'], + ], + esmlog => [ + ['other', 'CRITICAL'], + ['unknown', 'UNKNOWN'], + ['ok', 'OK'], + ['nonCritical', 'WARNING'], + ['critical', 'CRITICAL'], + ['nonRecoverable', 'CRITICAL'], + ], + fan => [ + ['other', 'CRITICAL'], + ['unknown', 'UNKNOWN'], + ['ok', 'OK'], + ['nonCriticalUpper', 'WARNING'], + ['criticalUpper', 'CRITICAL'], + ['nonRecoverableUpper', 'CRITICAL'], + ['nonCriticalLower', 'WARNING'], + ['criticalLower', 'CRITICAL'], + ['nonRecoverableLower', 'CRITICAL'], + ['failed', 'CRITICAL'] + ], + logicaldrive => [ + ['other', 'CRITICAL'], + ['unknown', 'UNKNOWN'], + ['ok', 'OK'], + ['nonCritical', 'WARNING'], + ['critical', 'CRITICAL'], + ['nonRecoverable', 'CRITICAL'], + ], + memory => [ + ['other', 'CRITICAL'], + ['unknown', 'UNKNOWN'], + ['ok', 'OK'], + ['nonCritical', 'WARNING'], + ['critical', 'CRITICAL'], + ['nonRecoverable', 'CRITICAL'], + ], + physicaldisk => [ + ['other', 'CRITICAL'], + ['unknown', 'UNKNOWN'], + ['ok', 'OK'], + ['nonCritical', 'WARNING'], + ['critical', 'CRITICAL'], + ['nonRecoverable', 'CRITICAL'], + ], + physicaldisk_smartalert => [ + ['yes', 'CRITICAL'], + ['no', 'OK'], + ], + psu => [ + ['other', 'CRITICAL'], + ['unknown', 'UNKNOWN'], + ['ok', 'OK'], + ['nonCritical', 'WARNING'], + ['critical', 'CRITICAL'], + ['nonRecoverable', 'CRITICAL'], + ], + temperature => [ + ['other', 'CRITICAL'], + ['unknown', 'UNKNOWN'], + ['ok', 'OK'], + ['nonCriticalUpper', 'WARNING'], + ['criticalUpper', 'CRITICAL'], + ['nonRecoverableUpper', 'CRITICAL'], + ['nonCriticalLower', 'WARNING'], + ['criticalLower', 'CRITICAL'], + ['nonRecoverableLower', 'CRITICAL'], + ['failed', 'CRITICAL'], + ], +}; + +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 => + { + "exclude:s" => { name => 'exclude' }, + "component:s" => { name => 'component', default => '.*' }, + "no-component:s" => { name => 'no_component' }, + "threshold-overload:s@" => { name => 'threshold_overload' }, + "warning:s@" => { name => 'warning' }, + "critical:s@" => { name => 'critical' }, + }); + + $self->{product_name} = undef; + $self->{components} = {}; + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::init(%options); + + if (defined($self->{option_results}->{no_component})) { + if ($self->{option_results}->{no_component} ne '') { + $self->{no_components} = $self->{option_results}->{no_component}; + } else { + $self->{no_components} = 'critical'; + } + } + + $self->{overload_th} = {}; + foreach my $val (@{$self->{option_results}->{threshold_overload}}) { + if ($val !~ /^(.*?),(.*?),(.*)$/) { + $self->{output}->add_option_msg(short_msg => "Wrong threshold-overload option '" . $val . "'."); + $self->{output}->option_exit(); + } + my ($section, $status, $filter) = ($1, $2, $3); + if ($self->{output}->is_litteral_status(status => $status) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong threshold-overload status '" . $val . "'."); + $self->{output}->option_exit(); + } + $self->{overload_th}->{$section} = [] if (!defined($self->{overload_th}->{$section})); + push @{$self->{overload_th}->{$section}}, {filter => $filter, status => $status}; + } + + $self->{numeric_threshold} = {}; + foreach my $option (('warning', 'critical')) { + foreach my $val (@{$self->{option_results}->{$option}}) { + if ($val !~ /^(.*?),(.*?),(.*)$/) { + $self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "'."); + $self->{output}->option_exit(); + } + my ($section, $regexp, $value) = ($1, $2, $3); + if ($section !~ /^(temperature|fan|psu\.power)$/) { + $self->{output}->add_option_msg(short_msg => "Wrong $option option '" . $val . "' (type must be: temperature, fan, psu.power)."); + $self->{output}->option_exit(); + } + my $position = 0; + if (defined($self->{numeric_threshold}->{$section})) { + $position = scalar(@{$self->{numeric_threshold}->{$section}}); + } + if (($self->{perfdata}->threshold_validate(label => $option . '-' . $section . '-' . $position, value => $value)) == 0) { + $self->{output}->add_option_msg(short_msg => "Wrong $option threshold '" . $value . "'."); + $self->{output}->option_exit(); + } + $self->{numeric_threshold}->{$section} = [] if (!defined($self->{numeric_threshold}->{$section})); + push @{$self->{numeric_threshold}->{$section}}, { label => $option . '-' . $section . '-' . $position, threshold => $option, regexp => $regexp }; + } + } +} + +sub run { + my ($self, %options) = @_; + # $options{snmp} = snmp object + $self->{snmp} = $options{snmp}; + + # In '10892-MIB' + my $oid_chassisModelName = ".1.3.6.1.4.1.674.10892.1.300.10.1.9"; + my $snmp_request = [ { oid => $oid_chassisModelName } ]; + + my @components = ('globalstatus', 'fan', 'psu', 'temperature', 'cpu', 'cachebattery', 'memory', + 'physicaldisk', 'logicaldrive', 'esmlog', 'battery', 'controller', 'connector'); + foreach (@components) { + if (/$self->{option_results}->{component}/) { + my $mod_name = "hardware::server::dell::openmanage::snmp::mode::components::$_"; + centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $mod_name, + error_msg => "Cannot load module '$mod_name'."); + my $func = $mod_name->can('load'); + $func->(request => $snmp_request); + } + } + + if (scalar(@{$snmp_request}) == 1) { + $self->{output}->add_option_msg(short_msg => "Wrong option. Cannot find component '" . $self->{option_results}->{component} . "'."); + $self->{output}->option_exit(); + } + $self->{results} = $self->{snmp}->get_multiple_table(oids => $snmp_request); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_chassisModelName}})) { + my $name = defined($self->{results}->{$oid_chassisModelName}->{$oid}) ? + centreon::plugins::misc::trim($self->{results}->{$oid_chassisModelName}->{$oid}) : 'unknown'; + $self->{output}->output_add(long_msg => sprintf("Product Name: %s", $self->{product_name})); + } + + foreach (@components) { + if (/$self->{option_results}->{component}/) { + my $mod_name = "hardware::server::dell::openmanage::snmp::mode::components::$_"; + my $func = $mod_name->can('check'); + $func->($self); + } + } + + 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 && $self->{components}->{$comp}->{skip} == 0); + $total_components += $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip}; + my $count_by_components = $self->{components}->{$comp}->{total} + $self->{components}->{$comp}->{skip}; + $display_by_component .= $display_by_component_append . $self->{components}->{$comp}->{total} . '/' . $count_by_components . ' ' . $self->{components}->{$comp}->{name}; + $display_by_component_append = ', '; + } + + $self->{output}->output_add(severity => 'OK', + short_msg => sprintf("All %s components are ok [%s].", + $total_components, + $display_by_component) + ); + + if (defined($self->{option_results}->{no_component}) && $total_components == 0) { + $self->{output}->output_add(severity => $self->{no_components}, + short_msg => 'No components are checked.'); + } + + $self->{output}->display(); + $self->{output}->exit(); +} + +sub check_exclude { + my ($self, %options) = @_; + + if (defined($options{instance})) { + if (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)${options{section}}[^,]*#\Q$options{instance}\E#/) { + $self->{components}->{$options{section}}->{skip}++; + $self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section $options{instance} instance.")); + return 1; + } + } elsif (defined($self->{option_results}->{exclude}) && $self->{option_results}->{exclude} =~ /(^|\s|,)$options{section}(\s|,|$)/) { + $self->{output}->output_add(long_msg => sprintf("Skipping $options{section} section.")); + return 1; + } + return 0; +} + +sub get_severity_numeric { + my ($self, %options) = @_; + my $status = 'OK'; # default + my $thresholds = { warning => undef, critical => undef }; + my $checked = 0; + + if (defined($self->{numeric_threshold}->{$options{section}})) { + my $exits = []; + foreach (@{$self->{numeric_threshold}->{$options{section}}}) { + if ($options{instance} =~ /$_->{regexp}/) { + push @{$exits}, $self->{perfdata}->threshold_check(value => $options{value}, threshold => [ { label => $_->{label}, exit_litteral => $_->{threshold} } ]); + $thresholds->{$_->{threshold}} = $self->{perfdata}->get_perfdata_for_output(label => $_->{label}); + $checked = 1; + } + } + $status = $self->{output}->get_most_critical(status => $exits) if (scalar(@{$exits}) > 0); + } + + return ($status, $thresholds->{warning}, $thresholds->{critical}, $checked); +} + +sub get_severity { + my ($self, %options) = @_; + my $status = 'UNKNOWN'; # default + + if (defined($self->{overload_th}->{$options{section}})) { + foreach (@{$self->{overload_th}->{$options{section}}}) { + if ($options{value} =~ /$_->{filter}/i) { + $status = $_->{status}; + return $status; + } + } + } + foreach (@{$thresholds->{$options{section}}}) { + if ($options{value} =~ /$$_[0]/i) { + $status = $$_[1]; + return $status; + } + } + + return $status; +} +1; + +__END__ + +=head1 MODE + +Check Hardware (Global status, Fans, CPUs, Power Supplies, Temperature, Storage). + +=over 8 + +=item B<--component> + +Which component to check (Default: '.*'). +Can be: 'globalstatus', 'fan', 'cpu', 'psu', 'temperature', 'cachebattery', +'physicaldisk', 'logicaldrive', 'battery', 'controller', 'connector'. + +=item B<--exclude> + +Exclude some parts (comma seperated list) (Example: --exclude=fan,cpu) +Can also exclude specific instance: --exclude=fan#1#,cpu + +=item B<--no-component> + +Return an error if no compenents are checked. +If total (with skipped) is 0. (Default: 'critical' returns). + +=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> + +Set warning threshold for temperature, psu.power or fan (syntax: type,regexp,threshold) +Example: --warning='temperature,.*,30' + +=item B<--critical> + +Set critical threshold for temperature, psu.power or fan (syntax: type,regexp,threshold) +Example: --critical='temperature,.*,40' + +=back + +=cut + diff --git a/centreon-plugins/hardware/server/dell/openmanage/plugin.pm b/centreon-plugins/hardware/server/dell/openmanage/snmp/plugin.pm similarity index 93% rename from centreon-plugins/hardware/server/dell/openmanage/plugin.pm rename to centreon-plugins/hardware/server/dell/openmanage/snmp/plugin.pm index 960f748ef..bf8a1dbda 100644 --- a/centreon-plugins/hardware/server/dell/openmanage/plugin.pm +++ b/centreon-plugins/hardware/server/dell/openmanage/snmp/plugin.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package hardware::server::dell::openmanage::plugin; +package hardware::server::dell::openmanage::snmp::plugin; use strict; use warnings; @@ -32,7 +32,7 @@ sub new { $self->{version} = '1.0'; %{$self->{modes}} = ( - 'hardware' => 'hardware::server::dell::openmanage::mode::hardware', + 'hardware' => 'hardware::server::dell::openmanage::snmp::mode::hardware', ); return $self;