From 19c30a4951346c119dcb00da48134edc7a55c72d Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Tue, 1 Dec 2020 15:23:12 +0100 Subject: [PATCH] Fix #2381 --- .../idrac/snmp/mode/components/amperage.pm | 42 ++++++--- .../snmp/mode/components/coolingdevice.pm | 35 +++++--- .../idrac/snmp/mode/components/coolingunit.pm | 26 ++++-- .../idrac/snmp/mode/components/enclosure.pm | 90 +++++++++++++++++++ .../dell/idrac/snmp/mode/components/fru.pm | 17 ++-- .../dell/idrac/snmp/mode/components/memory.pm | 26 ++++-- .../idrac/snmp/mode/components/network.pm | 17 ++-- .../dell/idrac/snmp/mode/components/pci.pm | 26 ++++-- .../idrac/snmp/mode/components/processor.pm | 26 ++++-- .../dell/idrac/snmp/mode/components/psu.pm | 2 +- .../dell/idrac/snmp/mode/components/punit.pm | 26 ++++-- .../idrac/snmp/mode/components/resources.pm | 29 ++++-- .../dell/idrac/snmp/mode/components/slot.pm | 17 ++-- .../snmp/mode/components/storagebattery.pm | 17 ++-- .../idrac/snmp/mode/components/storagectrl.pm | 17 ++-- .../snmp/mode/components/systembattery.pm | 2 +- .../idrac/snmp/mode/components/temperature.pm | 53 +++++++---- .../dell/idrac/snmp/mode/components/vdisk.pm | 4 +- .../idrac/snmp/mode/components/voltage.pm | 39 +++++--- .../server/dell/idrac/snmp/mode/hardware.pm | 27 ++++-- 20 files changed, 390 insertions(+), 148 deletions(-) create mode 100644 hardware/server/dell/idrac/snmp/mode/components/enclosure.pm diff --git a/hardware/server/dell/idrac/snmp/mode/components/amperage.pm b/hardware/server/dell/idrac/snmp/mode/components/amperage.pm index 6e13ed6ec..6b5ed339a 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/amperage.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/amperage.pm @@ -33,7 +33,7 @@ my $mapping = { amperageProbeUpperCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.30.1.10' }, amperageProbeUpperNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.30.1.11' }, amperageProbeLowerNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.30.1.12' }, - amperageProbeLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.30.1.13' }, + amperageProbeLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.30.1.13' } }; my $oid_amperageProbeTableEntry = '.1.3.6.1.4.1.674.10892.5.4.600.30.1'; @@ -70,21 +70,30 @@ sub check { $divisor = 1; } $result->{amperageProbeReading} = (defined($result->{amperageProbeReading})) ? $result->{amperageProbeReading} / $divisor : 'unknown'; - $self->{output}->output_add(long_msg => sprintf("amperage '%s' status is '%s' [instance = %s] [state = %s] [value = %s]", - $result->{amperageProbeLocationName}, $result->{amperageProbeStatus}, $instance, - $result->{amperageProbeStateSettings}, $result->{amperageProbeReading})); + $self->{output}->output_add( + long_msg => sprintf( + "amperage '%s' status is '%s' [instance = %s] [state = %s] [value = %s]", + $result->{amperageProbeLocationName}, $result->{amperageProbeStatus}, $instance, + $result->{amperageProbeStateSettings}, $result->{amperageProbeReading} + ) + ); my $exit = $self->get_severity(label => 'default.state', section => 'amperage.state', value => $result->{amperageProbeStateSettings}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Amperage '%s' state is '%s'", $result->{amperageProbeLocationName}, $result->{amperageProbeStateSettings})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Amperage '%s' state is '%s'", $result->{amperageProbeLocationName}, $result->{amperageProbeStateSettings}) + ); next; } $exit = $self->get_severity(label => 'probe.status', section => 'amperage.status', value => $result->{amperageProbeStatus}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Amperage '%s' status is '%s'", $result->{amperageProbeLocationName}, $result->{amperageProbeStatus})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf( + "Amperage '%s' status is '%s'", $result->{amperageProbeLocationName}, $result->{amperageProbeStatus}) + ); } next if ($result->{amperageProbeType} =~ /amperageProbeTypeIsDiscrete/); @@ -105,15 +114,22 @@ sub check { $self->{perfdata}->threshold_validate(label => 'warning-amperage-instance-' . $instance, value => $warn_th); $self->{perfdata}->threshold_validate(label => 'critical-amperage-instance-' . $instance, value => $crit_th); - $exit = $self->{perfdata}->threshold_check(value => $result->{amperageProbeReading}, threshold => [ { label => 'critical-amperage-instance-' . $instance, exit_litteral => 'critical' }, - { label => 'warning-amperage-instance-' . $instance, exit_litteral => 'warning' } ]); + $exit = $self->{perfdata}->threshold_check( + value => $result->{amperageProbeReading}, + threshold => [ + { label => 'critical-amperage-instance-' . $instance, exit_litteral => 'critical' }, + { label => 'warning-amperage-instance-' . $instance, exit_litteral => 'warning' } + ] + ); $warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-amperage-instance-' . $instance); $crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-amperage-instance-' . $instance); } if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Amperage '%s' is %s %s", $result->{amperageProbeLocationName}, $result->{amperageProbeReading}, $unit)); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Amperage '%s' is %s %s", $result->{amperageProbeLocationName}, $result->{amperageProbeReading}, $unit) + ); } $self->{output}->perfdata_add( label => 'amperage', unit => $unit, @@ -121,7 +137,7 @@ sub check { instances => $result->{amperageProbeLocationName}, value => $result->{amperageProbeReading}, warning => $warn, - critical => $crit, + critical => $crit ); } } diff --git a/hardware/server/dell/idrac/snmp/mode/components/coolingdevice.pm b/hardware/server/dell/idrac/snmp/mode/components/coolingdevice.pm index a19636d72..2420c225f 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/coolingdevice.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/coolingdevice.pm @@ -32,7 +32,7 @@ my $mapping = { coolingDeviceUpperCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.10' }, coolingDeviceUpperNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.11' }, coolingDeviceLowerNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.12' }, - coolingDeviceLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.12.1.13' }, + coolingDeviceLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.12.1.13' } }; my $oid_coolingDeviceTableEntry = '.1.3.6.1.4.1.674.10892.5.4.700.12.1'; @@ -62,10 +62,14 @@ sub check { $self->{components}->{coolingdevice}->{total}++; $result->{coolingDeviceReading} = (defined($result->{coolingDeviceReading})) ? $result->{coolingDeviceReading} : 'unknown'; - $self->{output}->output_add(long_msg => sprintf("cooling device '%s' status is '%s' [instance = %s] [state = %s] [value = %s]", - $result->{coolingDeviceLocationName}, $result->{coolingDeviceStatus}, $instance, - $result->{coolingDeviceStateSettings}, $result->{coolingDeviceReading})); - + $self->{output}->output_add( + long_msg => sprintf( + "cooling device '%s' status is '%s' [instance = %s] [state = %s] [value = %s]", + $result->{coolingDeviceLocationName}, $result->{coolingDeviceStatus}, $instance, + $result->{coolingDeviceStateSettings}, $result->{coolingDeviceReading} + ) + ); + my $exit = $self->get_severity(label => 'default.state', section => 'coolingdevice.state', value => $result->{coolingDeviceStateSettings}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add(severity => $exit, @@ -75,8 +79,10 @@ sub check { $exit = $self->get_severity(label => 'probe.status', section => 'coolingdevice.status', value => $result->{coolingDeviceStatus}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Cooling device '%s' status is '%s'", $result->{coolingDeviceLocationName}, $result->{coolingDeviceStatus})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Cooling device '%s' status is '%s'", $result->{coolingDeviceLocationName}, $result->{coolingDeviceStatus}) + ); } if (defined($result->{coolingDeviceReading}) && $result->{coolingDeviceReading} =~ /[0-9]/) { @@ -95,15 +101,22 @@ sub check { $self->{perfdata}->threshold_validate(label => 'warning-coolingdevice-instance-' . $instance, value => $warn_th); $self->{perfdata}->threshold_validate(label => 'critical-coolingdevice-instance-' . $instance, value => $crit_th); - $exit = $self->{perfdata}->threshold_check(value => $result->{coolingDeviceReading}, threshold => [ { label => 'critical-coolingdevice-instance-' . $instance, exit_litteral => 'critical' }, - { label => 'warning-coolingdevice-instance-' . $instance, exit_litteral => 'warning' } ]); + $exit = $self->{perfdata}->threshold_check( + value => $result->{coolingDeviceReading}, + threshold => [ + { label => 'critical-coolingdevice-instance-' . $instance, exit_litteral => 'critical' }, + { label => 'warning-coolingdevice-instance-' . $instance, exit_litteral => 'warning' } + ] + ); $warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-coolingdevice-instance-' . $instance); $crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-coolingdevice-instance-' . $instance); } if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Cooling device '%s' is %s rpm", $result->{coolingDeviceLocationName}, $result->{coolingDeviceReading})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Cooling device '%s' is %s rpm", $result->{coolingDeviceLocationName}, $result->{coolingDeviceReading}) + ); } $self->{output}->perfdata_add( label => 'fan', unit => 'rpm', diff --git a/hardware/server/dell/idrac/snmp/mode/components/coolingunit.pm b/hardware/server/dell/idrac/snmp/mode/components/coolingunit.pm index 3289be91f..e7c359768 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/coolingunit.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/coolingunit.pm @@ -27,7 +27,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta my $mapping = { coolingUnitStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.10.1.4', map => \%map_state }, coolingUnitName => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.10.1.7' }, - coolingUnitStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.10.1.8', map => \%map_status }, + coolingUnitStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.10.1.8', map => \%map_status } }; my $oid_coolingUnitTableEntry = '.1.3.6.1.4.1.674.10892.5.4.700.10.1'; @@ -56,21 +56,29 @@ sub check { next if ($self->check_filter(section => 'coolingunit', instance => $instance)); $self->{components}->{coolingunit}->{total}++; - $self->{output}->output_add(long_msg => sprintf("cooling unit '%s' status is '%s' [instance = %s] [state = %s]", - $result->{coolingUnitName}, $result->{coolingUnitStatus}, $instance, - $result->{coolingUnitStateSettings})); - + $self->{output}->output_add( + long_msg => sprintf( + "cooling unit '%s' status is '%s' [instance = %s] [state = %s]", + $result->{coolingUnitName}, $result->{coolingUnitStatus}, $instance, + $result->{coolingUnitStateSettings} + ) + ); + my $exit = $self->get_severity(label => 'default.state', section => 'coolingunit.state', value => $result->{coolingUnitStateSettings}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Cooling unit '%s' state is '%s'", $result->{coolingUnitName}, $result->{coolingUnitStateSettings})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Cooling unit '%s' state is '%s'", $result->{coolingUnitName}, $result->{coolingUnitStateSettings}) + ); next; } $exit = $self->get_severity(label => 'default.status', section => 'coolingunit.status', value => $result->{coolingUnitStatus}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Cooling unit '%s' status is '%s'", $result->{coolingUnitName}, $result->{coolingUnitStatus})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Cooling unit '%s' status is '%s'", $result->{coolingUnitName}, $result->{coolingUnitStatus}) + ); } } } diff --git a/hardware/server/dell/idrac/snmp/mode/components/enclosure.pm b/hardware/server/dell/idrac/snmp/mode/components/enclosure.pm new file mode 100644 index 000000000..9c66b14ed --- /dev/null +++ b/hardware/server/dell/idrac/snmp/mode/components/enclosure.pm @@ -0,0 +1,90 @@ +# +# Copyright 2020 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::idrac::snmp::mode::components::enclosure; + +use strict; +use warnings; +use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_status %map_enclosure_state); + +my $mapping = { + enclosureName => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.3.1.2' }, + enclosureState => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.3.1.4', map => \%map_enclosure_state }, + enclosureRollUpStatus => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.3.1.23', map => \%map_status } +}; +my $oid_enclosureTableEntry = '.1.3.6.1.4.1.674.10892.5.5.1.20.130.3'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { + oid => $oid_enclosureTableEntry, + start => $mapping->{enclosureName}->{oid}, + end => $mapping->{enclosureRollUpStatus}->{oid} + }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking enclosures"); + $self->{components}->{enclosure} = {name => 'enclosures', total => 0, skip => 0}; + return if ($self->check_filter(section => 'enclosure')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_enclosureTableEntry}})) { + next if ($oid !~ /^$mapping->{enclosureRollUpStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_enclosureTableEntry}, instance => $instance); + + next if ($self->check_filter(section => 'enclosure', instance => $instance)); + $self->{components}->{enclosure}->{total}++; + + $self->{output}->output_add( + long_msg => sprintf( + "enclosure '%s' status is '%s' [instance = %s] [state = %s]", + $result->{enclosureName}, $result->{enclosureRollUpStatus}, $instance, + $result->{enclosureState} + ) + ); + + my $exit = $self->get_severity(section => 'enclosure.state', value => $result->{enclosureState}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf( + "Enclosure '%s' state is '%s'", $result->{enclosureName}, $result->{enclosureState} + ) + ); + next; + } + + $exit = $self->get_severity(label => 'default.status', section => 'enclosure.status', value => $result->{enclosureRollUpStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf( + "Enclosure '%s' status is '%s'", $result->{enclosureName}, $result->{enclosureRollUpStatus} + ) + ); + } + } +} + +1; diff --git a/hardware/server/dell/idrac/snmp/mode/components/fru.pm b/hardware/server/dell/idrac/snmp/mode/components/fru.pm index d005760b9..c207dcec1 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/fru.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/fru.pm @@ -26,7 +26,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta my $mapping = { fruInformationStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.2000.10.1.3', map => \%map_status }, - fruSerialNumberName => { oid => '.1.3.6.1.4.1.674.10892.5.4.2000.10.1.7' }, + fruSerialNumberName => { oid => '.1.3.6.1.4.1.674.10892.5.4.2000.10.1.7' } }; my $oid_fruTableEntry = '.1.3.6.1.4.1.674.10892.5.4.2000.10.1'; @@ -55,14 +55,19 @@ sub check { next if ($self->check_filter(section => 'fru', instance => $instance)); $self->{components}->{fru}->{total}++; - $self->{output}->output_add(long_msg => sprintf("fru '%s' status is '%s' [instance = %s]", - $result->{fruSerialNumberName}, $result->{fruInformationStatus}, $instance, - )); + $self->{output}->output_add( + long_msg => sprintf( + "fru '%s' status is '%s' [instance = %s]", + $result->{fruSerialNumberName}, $result->{fruInformationStatus}, $instance, + ) + ); my $exit = $self->get_severity(label => 'default.status', section => 'fru.status', value => $result->{fruInformationStatus}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Fru '%s' status is '%s'", $result->{fruSerialNumberName}, $result->{fruInformationStatus})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Fru '%s' status is '%s'", $result->{fruSerialNumberName}, $result->{fruInformationStatus}) + ); } } } diff --git a/hardware/server/dell/idrac/snmp/mode/components/memory.pm b/hardware/server/dell/idrac/snmp/mode/components/memory.pm index 3695e987b..c4ba735ca 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/memory.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/memory.pm @@ -27,7 +27,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta my $mapping = { memoryDeviceStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.50.1.4', map => \%map_state }, memoryDeviceStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.50.1.5', map => \%map_status }, - memoryDeviceLocationName => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.50.1.8' }, + memoryDeviceLocationName => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.50.1.8' } }; my $oid_memoryDeviceTableEntry = '.1.3.6.1.4.1.674.10892.5.4.1100.50.1'; @@ -56,21 +56,29 @@ sub check { next if ($self->check_filter(section => 'memory', instance => $instance)); $self->{components}->{memory}->{total}++; - $self->{output}->output_add(long_msg => sprintf("memory '%s' status is '%s' [instance = %s] [state = %s]", - $result->{memoryDeviceLocationName}, $result->{memoryDeviceStatus}, $instance, - $result->{memoryDeviceStateSettings})); - + $self->{output}->output_add( + long_msg => sprintf( + "memory '%s' status is '%s' [instance = %s] [state = %s]", + $result->{memoryDeviceLocationName}, $result->{memoryDeviceStatus}, $instance, + $result->{memoryDeviceStateSettings} + ) + ); + my $exit = $self->get_severity(label => 'default.state', section => 'memory.state', value => $result->{memoryDeviceStateSettings}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Memory '%s' state is '%s'", $result->{memoryDeviceLocationName}, $result->{memoryDeviceStateSettings})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Memory '%s' state is '%s'", $result->{memoryDeviceLocationName}, $result->{memoryDeviceStateSettings}) + ); next; } $exit = $self->get_severity(label => 'default.status', section => 'memory.status', value => $result->{memoryDeviceStatus}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Memory '%s' status is '%s'", $result->{memoryDeviceLocationName}, $result->{memoryDeviceStatus})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Memory '%s' status is '%s'", $result->{memoryDeviceLocationName}, $result->{memoryDeviceStatus}) + ); } } } diff --git a/hardware/server/dell/idrac/snmp/mode/components/network.pm b/hardware/server/dell/idrac/snmp/mode/components/network.pm index 3fcd32279..6325c0102 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/network.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/network.pm @@ -26,7 +26,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta my $mapping = { networkDeviceStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.90.1.3', map => \%map_status }, - networkDeviceProductName => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.90.1.6' }, + networkDeviceProductName => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.90.1.6' } }; my $oid_networkDeviceTableEntry = '.1.3.6.1.4.1.674.10892.5.4.1100.90.1'; @@ -55,14 +55,19 @@ sub check { next if ($self->check_filter(section => 'network', instance => $instance)); $self->{components}->{network}->{total}++; - $self->{output}->output_add(long_msg => sprintf("network '%s' status is '%s' [instance = %s]", - $result->{networkDeviceProductName}, $result->{networkDeviceStatus}, $instance, - )); + $self->{output}->output_add( + long_msg => sprintf( + "network '%s' status is '%s' [instance = %s]", + $result->{networkDeviceProductName}, $result->{networkDeviceStatus}, $instance + ) + ); my $exit = $self->get_severity(label => 'default.status', section => 'network.status', value => $result->{networkDeviceStatus}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Network '%s' status is '%s'", $result->{networkDeviceProductName}, $result->{networkDeviceStatus})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Network '%s' status is '%s'", $result->{networkDeviceProductName}, $result->{networkDeviceStatus}) + ); } } } diff --git a/hardware/server/dell/idrac/snmp/mode/components/pci.pm b/hardware/server/dell/idrac/snmp/mode/components/pci.pm index 68013cd4d..d2bf6b2d1 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/pci.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/pci.pm @@ -27,7 +27,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta my $mapping = { pCIDeviceStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.80.1.4', map => \%map_state }, pCIDeviceStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.80.1.5', map => \%map_status }, - pCIDeviceDescriptionName => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.80.1.9' }, + pCIDeviceDescriptionName => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.80.1.9' } }; my $oid_pCIDeviceTableEntry = '.1.3.6.1.4.1.674.10892.5.4.1100.80.1'; @@ -56,21 +56,29 @@ sub check { next if ($self->check_filter(section => 'pci', instance => $instance)); $self->{components}->{pci}->{total}++; - $self->{output}->output_add(long_msg => sprintf("pci '%s' status is '%s' [instance = %s] [state = %s]", - $result->{pCIDeviceDescriptionName}, $result->{pCIDeviceStatus}, $instance, - $result->{pCIDeviceStateSettings})); - + $self->{output}->output_add( + long_msg => sprintf( + "pci '%s' status is '%s' [instance = %s] [state = %s]", + $result->{pCIDeviceDescriptionName}, $result->{pCIDeviceStatus}, $instance, + $result->{pCIDeviceStateSettings} + ) + ); + my $exit = $self->get_severity(label => 'default.state', section => 'pci.state', value => $result->{pCIDeviceStateSettings}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("PCI '%s' state is '%s'", $result->{pCIDeviceDescriptionName}, $result->{pCIDeviceStateSettings})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("PCI '%s' state is '%s'", $result->{pCIDeviceDescriptionName}, $result->{pCIDeviceStateSettings}) + ); next; } $exit = $self->get_severity(label => 'default.status', section => 'pci.status', value => $result->{pCIDeviceStatus}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("PCI '%s' status is '%s'", $result->{pCIDeviceDescriptionName}, $result->{pCIDeviceStatus})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("PCI '%s' status is '%s'", $result->{pCIDeviceDescriptionName}, $result->{pCIDeviceStatus}) + ); } } } diff --git a/hardware/server/dell/idrac/snmp/mode/components/processor.pm b/hardware/server/dell/idrac/snmp/mode/components/processor.pm index 206f8ee4f..0c5ed31fe 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/processor.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/processor.pm @@ -27,7 +27,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta my $mapping = { processorDeviceStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.30.1.4', map => \%map_state }, processorDeviceStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.30.1.5', map => \%map_status }, - processorDeviceFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.30.1.26' }, + processorDeviceFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.4.1100.30.1.26' } }; my $oid_processorDeviceTableEntry = '.1.3.6.1.4.1.674.10892.5.4.1100.30.1'; @@ -56,21 +56,29 @@ sub check { next if ($self->check_filter(section => 'processor', instance => $instance)); $self->{components}->{processor}->{total}++; - $self->{output}->output_add(long_msg => sprintf("processor '%s' status is '%s' [instance = %s] [state = %s]", - $result->{processorDeviceFQDD}, $result->{processorDeviceStatus}, $instance, - $result->{processorDeviceStateSettings})); - + $self->{output}->output_add( + long_msg => sprintf( + "processor '%s' status is '%s' [instance = %s] [state = %s]", + $result->{processorDeviceFQDD}, $result->{processorDeviceStatus}, $instance, + $result->{processorDeviceStateSettings} + ) + ); + my $exit = $self->get_severity(label => 'default.state', section => 'processor.state', value => $result->{processorDeviceStateSettings}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Processor '%s' state is '%s'", $result->{processorDeviceFQDD}, $result->{processorDeviceStateSettings})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Processor '%s' state is '%s'", $result->{processorDeviceFQDD}, $result->{processorDeviceStateSettings}) + ); next; } $exit = $self->get_severity(label => 'default.status', section => 'processor.status', value => $result->{processorDeviceStatus}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Processor '%s' status is '%s'", $result->{processorDeviceFQDD}, $result->{processorDeviceStatus})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Processor '%s' status is '%s'", $result->{processorDeviceFQDD}, $result->{processorDeviceStatus}) + ); } } } diff --git a/hardware/server/dell/idrac/snmp/mode/components/psu.pm b/hardware/server/dell/idrac/snmp/mode/components/psu.pm index b9e309b68..0e8578aea 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/psu.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/psu.pm @@ -26,7 +26,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta my $mapping = { powerSupplyStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.12.1.5', map => \%map_status }, - powerSupplyLocationName => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.12.1.8' }, + powerSupplyLocationName => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.12.1.8' } }; my $oid_powerSupplyTableEntry = '.1.3.6.1.4.1.674.10892.5.4.600.12.1'; diff --git a/hardware/server/dell/idrac/snmp/mode/components/punit.pm b/hardware/server/dell/idrac/snmp/mode/components/punit.pm index a5a653a10..60d452b45 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/punit.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/punit.pm @@ -27,7 +27,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta my $mapping = { powerUnitStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.10.1.4', map => \%map_state }, powerUnitName => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.10.1.7' }, - powerUnitStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.10.1.8', map => \%map_status }, + powerUnitStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.10.1.8', map => \%map_status } }; my $oid_powerUnitTableEntry = '.1.3.6.1.4.1.674.10892.5.4.600.10.1'; @@ -56,21 +56,29 @@ sub check { next if ($self->check_filter(section => 'punit', instance => $instance)); $self->{components}->{punit}->{total}++; - $self->{output}->output_add(long_msg => sprintf("power unit '%s' status is '%s' [instance = %s] [state = %s]", - $result->{powerUnitName}, $result->{powerUnitStatus}, $instance, - $result->{powerUnitStateSettings})); - + $self->{output}->output_add( + long_msg => sprintf( + "power unit '%s' status is '%s' [instance = %s] [state = %s]", + $result->{powerUnitName}, $result->{powerUnitStatus}, $instance, + $result->{powerUnitStateSettings} + ) + ); + my $exit = $self->get_severity(label => 'default.state', section => 'punit.state', value => $result->{powerUnitStateSettings}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Power unit '%s' state is '%s'", $result->{powerUnitName}, $result->{powerUnitStateSettings})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Power unit '%s' state is '%s'", $result->{powerUnitName}, $result->{powerUnitStateSettings}) + ); next; } $exit = $self->get_severity(label => 'default.status', section => 'punit.status', value => $result->{powerUnitStatus}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Power unit '%s' status is '%s'", $result->{powerUnitName}, $result->{powerUnitStatus})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Power unit '%s' status is '%s'", $result->{powerUnitName}, $result->{powerUnitStatus}) + ); } } } diff --git a/hardware/server/dell/idrac/snmp/mode/components/resources.pm b/hardware/server/dell/idrac/snmp/mode/components/resources.pm index 2175d820b..da5f90be5 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/resources.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/resources.pm @@ -27,17 +27,22 @@ use Exporter; our %map_state; our %map_status; our %map_probe_status; +our %map_enclosure_state; our %map_amperage_type; our %map_pdisk_state; our %map_pdisk_smartstate; our %map_vdisk_state; our @ISA = qw(Exporter); -our @EXPORT_OK = qw(%map_probe_status %map_state %map_status %map_amperage_type %map_pdisk_state %map_pdisk_smartstate %map_vdisk_state); +our @EXPORT_OK = qw( + %map_probe_status %map_enclosure_state %map_state + %map_status %map_amperage_type %map_pdisk_state + %map_pdisk_smartstate %map_vdisk_state +); %map_pdisk_smartstate = ( 0 => 'off', - 1 => 'on', + 1 => 'on' ); %map_probe_status = ( @@ -50,7 +55,7 @@ our @EXPORT_OK = qw(%map_probe_status %map_state %map_status %map_amperage_type 7 => 'nonCriticalLower', 8 => 'criticalLower', 9 => 'nonRecoverableLower', - 10 => 'failed', + 10 => 'failed' ); %map_status = ( @@ -59,14 +64,22 @@ our @EXPORT_OK = qw(%map_probe_status %map_state %map_status %map_amperage_type 3 => 'ok', 4 => 'nonCritical', 5 => 'critical', - 6 => 'nonRecoverable', + 6 => 'nonRecoverable' ); %map_state = ( 1 => 'unknown', 2 => 'enabled', 4 => 'notReady', - 6 => 'enabledAndNotReady', + 6 => 'enabledAndNotReady' +); + +%map_enclosure_state = ( + 1 => 'unknown', + 2 => 'ready', + 3 => 'failed', + 4 => 'missing', + 5 => 'degraded' ); %map_pdisk_state = ( @@ -79,14 +92,14 @@ our @EXPORT_OK = qw(%map_probe_status %map_state %map_status %map_amperage_type 7 => 'failed', 8 => 'non-raid', 9 => 'removed', - 10 => 'readonly', + 10 => 'readonly' ); %map_vdisk_state = ( 1 => 'unknown', 2 => 'online', 3 => 'failed', - 4 => 'degraded', + 4 => 'degraded' ); %map_amperage_type = ( @@ -109,7 +122,7 @@ our @EXPORT_OK = qw(%map_probe_status %map_state %map_status %map_amperage_type 23 => 'amperageProbeTypeIsPowerSupplyAmps', 24 => 'amperageProbeTypeIsPowerSupplyWatts', 25 => 'amperageProbeTypeIsSystemAmps', - 26 => 'amperageProbeTypeIsSystemWatts', + 26 => 'amperageProbeTypeIsSystemWatts' ); 1; diff --git a/hardware/server/dell/idrac/snmp/mode/components/slot.pm b/hardware/server/dell/idrac/snmp/mode/components/slot.pm index 61b934acc..39cc3c853 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/slot.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/slot.pm @@ -26,7 +26,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta my $mapping = { systemSlotStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.1200.10.1.5', map => \%map_status }, - systemSlotSlotExternalSlotName => { oid => '.1.3.6.1.4.1.674.10892.5.4.1200.10.1.8' }, + systemSlotSlotExternalSlotName => { oid => '.1.3.6.1.4.1.674.10892.5.4.1200.10.1.8' } }; my $oid_systemSlotTableEntry = '.1.3.6.1.4.1.674.10892.5.4.1200.10.1'; @@ -55,14 +55,19 @@ sub check { next if ($self->check_filter(section => 'slot', instance => $instance)); $self->{components}->{slot}->{total}++; - $self->{output}->output_add(long_msg => sprintf("slot '%s' status is '%s' [instance = %s]", - $result->{systemSlotSlotExternalSlotName}, $result->{systemSlotStatus}, $instance, - )); + $self->{output}->output_add( + long_msg => sprintf( + "slot '%s' status is '%s' [instance = %s]", + $result->{systemSlotSlotExternalSlotName}, $result->{systemSlotStatus}, $instance, + ) + ); my $exit = $self->get_severity(label => 'default.status', section => 'slot.status', value => $result->{systemSlotStatus}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Slot '%s' status is '%s'", $result->{systemSlotSlotExternalSlotName}, $result->{systemSlotStatus})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Slot '%s' status is '%s'", $result->{systemSlotSlotExternalSlotName}, $result->{systemSlotStatus}) + ); } } } diff --git a/hardware/server/dell/idrac/snmp/mode/components/storagebattery.pm b/hardware/server/dell/idrac/snmp/mode/components/storagebattery.pm index 647e9e104..11fd659e2 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/storagebattery.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/storagebattery.pm @@ -26,7 +26,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta my $mapping = { batteryComponentStatus => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.15.1.6', map => \%map_status }, - batteryFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.15.1.20' }, + batteryFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.15.1.20' } }; sub load { @@ -51,14 +51,19 @@ sub check { next if ($self->check_filter(section => 'storagebattery', instance => $instance)); $self->{components}->{storagebattery}->{total}++; - $self->{output}->output_add(long_msg => sprintf("storage battery '%s' status is '%s' [instance = %s]", - $result->{batteryFQDD}, $result->{batteryComponentStatus}, $instance, - )); + $self->{output}->output_add( + long_msg => sprintf( + "storage battery '%s' status is '%s' [instance = %s]", + $result->{batteryFQDD}, $result->{batteryComponentStatus}, $instance, + ) + ); my $exit = $self->get_severity(label => 'default.status', section => 'storagebattery.status', value => $result->{batteryComponentStatus}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Storage battery '%s' status is '%s'", $result->{batteryFQDD}, $result->{batteryComponentStatus})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Storage battery '%s' status is '%s'", $result->{batteryFQDD}, $result->{batteryComponentStatus}) + ); } } } diff --git a/hardware/server/dell/idrac/snmp/mode/components/storagectrl.pm b/hardware/server/dell/idrac/snmp/mode/components/storagectrl.pm index ee5afcd4a..18ad76d75 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/storagectrl.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/storagectrl.pm @@ -26,7 +26,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta my $mapping = { controllerComponentStatus => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.1.1.38', map => \%map_status }, - controllerFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.1.1.78' }, + controllerFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.1.1.78' } }; sub load { @@ -51,14 +51,19 @@ sub check { next if ($self->check_filter(section => 'storagectrl', instance => $instance)); $self->{components}->{storagectrl}->{total}++; - $self->{output}->output_add(long_msg => sprintf("storage controller '%s' status is '%s' [instance = %s]", - $result->{controllerFQDD}, $result->{controllerComponentStatus}, $instance, - )); + $self->{output}->output_add( + long_msg => sprintf( + "storage controller '%s' status is '%s' [instance = %s]", + $result->{controllerFQDD}, $result->{controllerComponentStatus}, $instance, + ) + ); my $exit = $self->get_severity(label => 'default.status', section => 'storagectrl.status', value => $result->{controllerComponentStatus}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Storage controllers '%s' status is '%s'", $result->{controllerFQDD}, $result->{controllerComponentStatus})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf("Storage controllers '%s' status is '%s'", $result->{controllerFQDD}, $result->{controllerComponentStatus}) + ); } } } diff --git a/hardware/server/dell/idrac/snmp/mode/components/systembattery.pm b/hardware/server/dell/idrac/snmp/mode/components/systembattery.pm index 3fa39a2da..987f21ed1 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/systembattery.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/systembattery.pm @@ -27,7 +27,7 @@ use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_sta my $mapping = { systemBatteryStateSettings => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.50.1.4', map => \%map_state }, systemBatteryStatus => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.50.1.5', map => \%map_status }, - systemBatteryLocationName => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.50.1.7' }, + systemBatteryLocationName => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.50.1.7' } }; my $oid_systemBatteryTableEntry = '.1.3.6.1.4.1.674.10892.5.4.600.50.1'; diff --git a/hardware/server/dell/idrac/snmp/mode/components/temperature.pm b/hardware/server/dell/idrac/snmp/mode/components/temperature.pm index dc09cdbe5..cf74da2f2 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/temperature.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/temperature.pm @@ -28,7 +28,7 @@ my %map_temp_type = ( 1 => 'temperatureProbeTypeIsOther', 2 => 'temperatureProbeTypeIsUnknown', 3 => 'temperatureProbeTypeIsAmbientESM', - 16 => 'temperatureProbeTypeIsDiscrete', + 16 => 'temperatureProbeTypeIsDiscrete' ); my $mapping = { @@ -40,7 +40,7 @@ my $mapping = { temperatureProbeUpperCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.10' }, temperatureProbeUpperNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.11' }, temperatureProbeLowerNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.12' }, - temperatureProbeLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.13' }, + temperatureProbeLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.700.20.1.13' } }; my $oid_temperatureProbeTableEntry = '.1.3.6.1.4.1.674.10892.5.4.700.20.1'; @@ -70,21 +70,33 @@ sub check { $self->{components}->{temperature}->{total}++; $result->{temperatureProbeReading} = (defined($result->{temperatureProbeReading})) ? $result->{temperatureProbeReading} / 10 : 'unknown'; - $self->{output}->output_add(long_msg => sprintf("temperature '%s' status is '%s' [instance = %s] [state = %s] [value = %s]", - $result->{temperatureProbeLocationName}, $result->{temperatureProbeStatus}, $instance, - $result->{temperatureProbeStateSettings}, $result->{temperatureProbeReading})); - + $self->{output}->output_add( + long_msg => sprintf( + "temperature '%s' status is '%s' [instance = %s] [state = %s] [value = %s]", + $result->{temperatureProbeLocationName}, $result->{temperatureProbeStatus}, $instance, + $result->{temperatureProbeStateSettings}, $result->{temperatureProbeReading} + ) + ); + my $exit = $self->get_severity(label => 'default.state', section => 'temperature.state', value => $result->{temperatureProbeStateSettings}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Temperature '%s' state is '%s'", $result->{temperatureProbeLocationName}, $result->{temperatureProbeStateSettings})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf( + "Temperature '%s' state is '%s'", $result->{temperatureProbeLocationName}, $result->{temperatureProbeStateSettings} + ) + ); next; } $exit = $self->get_severity(label => 'probe.status', section => 'temperature.status', 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'", $result->{temperatureProbeLocationName}, $result->{temperatureProbeStatus})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf( + "Temperature '%s' status is '%s'", $result->{temperatureProbeLocationName}, $result->{temperatureProbeStatus} + ) + ); } if (defined($result->{temperatureProbeReading}) && $result->{temperatureProbeReading} =~ /[0-9]/) { @@ -103,15 +115,24 @@ sub check { $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' } ]); + $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", $result->{temperatureProbeLocationName}, $result->{temperatureProbeReading})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf( + "Temperature '%s' is %s degree centigrade", $result->{temperatureProbeLocationName}, $result->{temperatureProbeReading} + ) + ); } $self->{output}->perfdata_add( label => 'temp', unit => 'C', @@ -119,7 +140,7 @@ sub check { instances => $result->{temperatureProbeLocationName}, value => $result->{temperatureProbeReading}, warning => $warn, - critical => $crit, + critical => $crit ); } } diff --git a/hardware/server/dell/idrac/snmp/mode/components/vdisk.pm b/hardware/server/dell/idrac/snmp/mode/components/vdisk.pm index 272770c2d..4b04239dc 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/vdisk.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/vdisk.pm @@ -25,8 +25,8 @@ use warnings; use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_vdisk_state); my $mapping = { - virtualDiskState => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.4', map => \%map_vdisk_state }, - virtualDiskFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.35' } + virtualDiskState => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.4', map => \%map_vdisk_state }, + virtualDiskFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.35' } }; sub load { diff --git a/hardware/server/dell/idrac/snmp/mode/components/voltage.pm b/hardware/server/dell/idrac/snmp/mode/components/voltage.pm index 8a95f9cb8..07cdbaf00 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/voltage.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/voltage.pm @@ -32,7 +32,7 @@ my $mapping = { voltageProbeUpperCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.20.1.10' }, voltageProbeUpperNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.20.1.11' }, voltageProbeLowerNonCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.20.1.12' }, - voltageProbeLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.20.1.13' }, + voltageProbeLowerCriticalThreshold => { oid => '.1.3.6.1.4.1.674.10892.5.4.600.20.1.13' } }; my $oid_voltageProbeTableEntry = '.1.3.6.1.4.1.674.10892.5.4.600.20.1'; @@ -57,7 +57,7 @@ sub check { next if ($oid !~ /^$mapping->{voltageProbeStatus}->{oid}\.(.*)$/); my $instance = $1; my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_voltageProbeTableEntry}, instance => $instance); - + next if ($self->check_filter(section => 'voltage', instance => $instance)); $self->{components}->{voltage}->{total}++; @@ -72,15 +72,23 @@ sub check { my $exit = $self->get_severity(label => 'default.state', section => 'voltage.state', value => $result->{voltageProbeStateSettings}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Voltage '%s' state is '%s'", $result->{voltageProbeLocationName}, $result->{voltageProbeStateSettings})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf( + "Voltage '%s' state is '%s'", $result->{voltageProbeLocationName}, $result->{voltageProbeStateSettings} + ) + ); next; } $exit = $self->get_severity(label => 'probe.status', section => 'voltage.status', value => $result->{voltageProbeStatus}); if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Voltage '%s' status is '%s'", $result->{voltageProbeLocationName}, $result->{voltageProbeStatus})); + $self->{output}->output_add( + severity => $exit, + short_msg => sprintf( + "Voltage '%s' status is '%s'", $result->{voltageProbeLocationName}, $result->{voltageProbeStatus} + ) + ); } if (defined($result->{voltageProbeReading}) && $result->{voltageProbeReading} =~ /[0-9]/) { @@ -98,17 +106,24 @@ sub check { my $crit_th = $result->{voltageProbeLowerCriticalThreshold} . ':' . $result->{voltageProbeUpperCriticalThreshold}; $self->{perfdata}->threshold_validate(label => 'warning-voltage-instance-' . $instance, value => $warn_th); $self->{perfdata}->threshold_validate(label => 'critical-voltage-instance-' . $instance, value => $crit_th); - - $exit = $self->{perfdata}->threshold_check(value => $result->{voltageProbeReading}, threshold => [ { label => 'critical-voltage-instance-' . $instance, exit_litteral => 'critical' }, - { label => 'warning-voltage-instance-' . $instance, exit_litteral => 'warning' } ]); + + $exit = $self->{perfdata}->threshold_check( + value => $result->{voltageProbeReading}, + threshold => [ + { label => 'critical-voltage-instance-' . $instance, exit_litteral => 'critical' }, + { label => 'warning-voltage-instance-' . $instance, exit_litteral => 'warning' } + ] + ); $warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-voltage-instance-' . $instance); $crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-voltage-instance-' . $instance); } - + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { $self->{output}->output_add( severity => $exit, - short_msg => sprintf("Voltage '%s' is %s V", $result->{voltageProbeLocationName}, $result->{voltageProbeReading}) + short_msg => sprintf( + "Voltage '%s' is %s V", $result->{voltageProbeLocationName}, $result->{voltageProbeReading} + ) ); } $self->{output}->perfdata_add( @@ -117,7 +132,7 @@ sub check { instances => $result->{voltageProbeLocationName}, value => $result->{voltageProbeReading}, warning => $warn, - critical => $crit, + critical => $crit ); } } diff --git a/hardware/server/dell/idrac/snmp/mode/hardware.pm b/hardware/server/dell/idrac/snmp/mode/hardware.pm index 9bb51a4c1..2c776661b 100644 --- a/hardware/server/dell/idrac/snmp/mode/hardware.pm +++ b/hardware/server/dell/idrac/snmp/mode/hardware.pm @@ -28,10 +28,10 @@ use warnings; sub set_system { my ($self, %options) = @_; - $self->{regexp_threshold_numeric_check_section_option} = '^(temperature|voltage|amperage|coolingdevice)$'; + $self->{regexp_threshold_numeric_check_section_option} = '^(?:temperature|voltage|amperage|coolingdevice)$'; $self->{cb_hook2} = 'snmp_execute'; - + $self->{thresholds} = { 'default.state' => [ ['unknown', 'UNKNOWN'], @@ -73,6 +73,13 @@ sub set_system { ['removed', 'OK'], ['readonly', 'WARNING'] ], + 'enclosure.state' => [ + ['unknown', 'UNKNOWN'], + ['ready', 'OK'], + ['failed', 'CRITICAL'], + ['missing', 'WARNING'], + ['degraded', 'WARNING'] + ], 'pdisk.smartalert' => [ ['off', 'OK'], ['on', 'WARNING'] @@ -87,15 +94,16 @@ sub set_system { $self->{components_path} = 'hardware::server::dell::idrac::snmp::mode::components'; $self->{components_module} = [ - 'psu', 'punit', 'temperature', 'voltage', 'amperage', - 'systembattery', 'coolingunit', 'coolingdevice', 'processor', 'memory', 'pci', 'network', - 'slot', 'fru', 'storagectrl', 'storagebattery', 'pdisk', 'vdisk' + 'amperage', 'coolingdevice', 'coolingunit', 'enclosure', + 'fru', 'memory', 'network', 'pci', 'pdisk', + 'processor', 'psu', 'punit', 'slot', 'storagebattery', + 'storagectrl', 'systembattery', 'temperature', 'voltage', 'vdisk' ]; } sub snmp_execute { my ($self, %options) = @_; - + $self->{snmp} = $options{snmp}; $self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request}); } @@ -123,9 +131,10 @@ Check hardware components. =item B<--component> Which component to check (Default: '.*'). -Can be: 'psu', 'punit', 'temperature', 'voltage', 'amperage', -'systembattery', 'coolingunit', 'coolingdevice', 'processor', 'memory', 'pci', 'network', -'slot', 'fru', 'storagectrl', 'storagebattery', 'pdisk', 'vdisk'. +Can be: 'amperage', 'coolingdevice', 'coolingunit', 'enclosure', +'fru', 'memory', 'network', 'pci', 'pdisk', +'processor', 'psu', 'punit', 'slot', 'storagebattery', +'storagectrl', 'systembattery', 'temperature', 'voltage', 'vdisk'. =item B<--filter>