diff --git a/hardware/server/dell/idrac/snmp/mode/components/fru.pm b/hardware/server/dell/idrac/snmp/mode/components/fru.pm new file mode 100644 index 000000000..f69778544 --- /dev/null +++ b/hardware/server/dell/idrac/snmp/mode/components/fru.pm @@ -0,0 +1,66 @@ +# +# Copyright 2016 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::fru; + +use strict; +use warnings; +use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_status); + +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' }, +}; +my $oid_fruTableEntry = '.1.3.6.1.4.1.674.10892.5.4.2000.10.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_fruTableEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking fru"); + $self->{components}->{fru} = {name => 'fru', total => 0, skip => 0}; + return if ($self->check_filter(section => 'fru')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_fruTableEntry}})) { + next if ($oid !~ /^$mapping->{fruInformationStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_fruTableEntry}, instance => $instance); + + 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, + )); + + 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})); + } + } +} + +1; \ No newline at end of file diff --git a/hardware/server/dell/idrac/snmp/mode/components/pdisk.pm b/hardware/server/dell/idrac/snmp/mode/components/pdisk.pm new file mode 100644 index 000000000..3e7d42eac --- /dev/null +++ b/hardware/server/dell/idrac/snmp/mode/components/pdisk.pm @@ -0,0 +1,74 @@ +# +# Copyright 2016 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::pdisk; + +use strict; +use warnings; +use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_status %map_pdisk_state); + +my $mapping = { + physicalDiskState => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.4', map => \%map_pdisk_state }, + physicalDiskComponentStatus => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.24', map => \%map_status }, + physicalDiskFQDD => { oid => '.1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.54' }, +}; +my $oid_physicalDiskTableEntry = '.1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_physicalDiskTableEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking physical disks"); + $self->{components}->{pdisk} = {name => 'physical disks', total => 0, skip => 0}; + return if ($self->check_filter(section => 'pdisk')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_physicalDiskTableEntry}})) { + next if ($oid !~ /^$mapping->{physicalDiskComponentStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_physicalDiskTableEntry}, instance => $instance); + + next if ($self->check_filter(section => 'pdisk', instance => $instance)); + $self->{components}->{pdisk}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("power unit '%s' status is '%s' [instance = %s] [state = %s]", + $result->{physicalDiskFQDD}, $result->{physicalDiskComponentStatus}, $instance, + $result->{physicalDiskState})); + + my $exit = $self->get_severity(section => 'pdisk.state', value => $result->{physicalDiskState}); + 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->{physicalDiskFQDD}, $result->{physicalDiskState})); + next; + } + + $exit = $self->get_severity(label => 'default.status', section => 'pdisk.status', value => $result->{physicalDiskComponentStatus}); + 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->{physicalDiskFQDD}, $result->{physicalDiskComponentStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/hardware/server/dell/idrac/snmp/mode/components/resources.pm b/hardware/server/dell/idrac/snmp/mode/components/resources.pm index 2cbad5fb8..c90f092c0 100644 --- a/hardware/server/dell/idrac/snmp/mode/components/resources.pm +++ b/hardware/server/dell/idrac/snmp/mode/components/resources.pm @@ -28,9 +28,11 @@ our %map_state; our %map_status; our %map_probe_status; our %map_amperage_type; +our %map_pdisk_state; +our %map_vdisk_state; our @ISA = qw(Exporter); -our @EXPORT_OK = qw(%map_probe_status %map_state %map_status %map_amperage_type); +our @EXPORT_OK = qw(%map_probe_status %map_state %map_status %map_amperage_type %map_pdisk_state %map_vdisk_state); %map_probe_status = ( 1 => 'other', @@ -61,6 +63,25 @@ our @EXPORT_OK = qw(%map_probe_status %map_state %map_status %map_amperage_type) 6 => 'enabledAndNotReady', ); +%map_pdisk_state = ( + 1 => 'unknown', + 2 => 'ready', + 3 => 'online', + 4 => 'foreign', + 5 => 'offline', + 6 => 'blocked', + 7 => 'failed', + 8 => 'non-raid', + 9 => 'removed', +); + +%map_vdisk_state = ( + 1 => 'unknown', + 2 => 'online', + 3 => 'failed', + 4 => 'degraded', +); + %map_amperage_type = ( 1 => 'amperageProbeTypeIsOther', 2 => 'amperageProbeTypeIsUnknown', diff --git a/hardware/server/dell/idrac/snmp/mode/components/slot.pm b/hardware/server/dell/idrac/snmp/mode/components/slot.pm new file mode 100644 index 000000000..6635f6b07 --- /dev/null +++ b/hardware/server/dell/idrac/snmp/mode/components/slot.pm @@ -0,0 +1,66 @@ +# +# Copyright 2016 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::slot; + +use strict; +use warnings; +use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_status); + +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' }, +}; +my $oid_systemSlotTableEntry = '.1.3.6.1.4.1.674.10892.5.4.1200.10.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_systemSlotTableEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking slots"); + $self->{components}->{slot} = {name => 'slots', total => 0, skip => 0}; + return if ($self->check_filter(section => 'slot')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_systemSlotTableEntry}})) { + next if ($oid !~ /^$mapping->{systemSlotStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_systemSlotTableEntry}, instance => $instance); + + 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, + )); + + 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})); + } + } +} + +1; \ No newline at end of file diff --git a/hardware/server/dell/idrac/snmp/mode/components/storagebattery.pm b/hardware/server/dell/idrac/snmp/mode/components/storagebattery.pm new file mode 100644 index 000000000..13d76bb0e --- /dev/null +++ b/hardware/server/dell/idrac/snmp/mode/components/storagebattery.pm @@ -0,0 +1,66 @@ +# +# Copyright 2016 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::storagebattery; + +use strict; +use warnings; +use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_status); + +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' }, +}; +my $oid_batteryTableEntry = '.1.3.6.1.4.1.674.10892.5.5.1.20.130.15.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_batteryTableEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking storage batteries"); + $self->{components}->{storagebattery} = {name => 'storage batteries', total => 0, skip => 0}; + return if ($self->check_filter(section => 'storagebattery')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_batteryTableEntry}})) { + next if ($oid !~ /^$mapping->{batteryComponentStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_batteryTableEntry}, instance => $instance); + + 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, + )); + + 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})); + } + } +} + +1; \ No newline at end of file diff --git a/hardware/server/dell/idrac/snmp/mode/components/storagectrl.pm b/hardware/server/dell/idrac/snmp/mode/components/storagectrl.pm new file mode 100644 index 000000000..f25df4572 --- /dev/null +++ b/hardware/server/dell/idrac/snmp/mode/components/storagectrl.pm @@ -0,0 +1,66 @@ +# +# Copyright 2016 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::storagectrl; + +use strict; +use warnings; +use hardware::server::dell::idrac::snmp::mode::components::resources qw(%map_status); + +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' }, +}; +my $oid_controllerTableEntry = '.1.3.6.1.4.1.674.10892.5.5.1.20.130.1.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_controllerTableEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking storage controllers"); + $self->{components}->{storagectrl} = {name => 'storage controllers', total => 0, skip => 0}; + return if ($self->check_filter(section => 'storagectrl')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_controllerTableEntry}})) { + next if ($oid !~ /^$mapping->{controllerComponentStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_controllerTableEntry}, instance => $instance); + + 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, + )); + + 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})); + } + } +} + +1; \ No newline at end of file diff --git a/hardware/server/dell/idrac/snmp/mode/components/vdisk.pm b/hardware/server/dell/idrac/snmp/mode/components/vdisk.pm new file mode 100644 index 000000000..ecf397788 --- /dev/null +++ b/hardware/server/dell/idrac/snmp/mode/components/vdisk.pm @@ -0,0 +1,67 @@ +# +# Copyright 2016 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::vdisk; + +use strict; +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' }, +}; +my $oid_virtualDiskTableEntry = '.1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_virtualDiskTableEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking virtual disks"); + $self->{components}->{vdisk} = {name => 'virtual disks', total => 0, skip => 0}; + return if ($self->check_filter(section => 'vdisk')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_virtualDiskTableEntry}})) { + next if ($oid !~ /^$mapping->{virtualDiskState}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_virtualDiskTableEntry}, instance => $instance); + + next if ($self->check_filter(section => 'vdisk', instance => $instance)); + $self->{components}->{vdisk}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("virtual disk '%s' state is '%s' [instance = %s]", + $result->{virtualDiskFQDD}, $result->{virtualDiskState}, $instance, + )); + + my $exit = $self->get_severity(section => 'vdisk.state', value => $result->{virtualDiskState}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Virtual disk '%s' state is '%s'", $result->{virtualDiskFQDD}, $result->{virtualDiskState})); + next; + } + } +} + +1; \ No newline at end of file diff --git a/hardware/server/dell/idrac/snmp/mode/hardware.pm b/hardware/server/dell/idrac/snmp/mode/hardware.pm index a1e0b9802..e5914295a 100644 --- a/hardware/server/dell/idrac/snmp/mode/hardware.pm +++ b/hardware/server/dell/idrac/snmp/mode/hardware.pm @@ -28,7 +28,6 @@ use warnings; sub set_system { my ($self, %options) = @_; - $self->{regexp_threshold_overload_check_section_option} = '^(psu|punit|temperature|voltage|amperage|systembattery|coolingunit|coolingdevice|processor|memory|pci|network)$'; $self->{regexp_threshold_numeric_check_section_option} = '^(temperature|voltage|amperage|coolingdevice)$'; $self->{cb_hook2} = 'snmp_execute'; @@ -59,13 +58,32 @@ sub set_system { ['nonRecoverableLower', 'CRITICAL'], ['failed', 'CRITICAL'], ], + 'pdisk.state' => [ + ['unknown', 'UNKNOWN'], + ['ready', 'OK'], + ['online', 'OK'], + ['foreign', 'OK'], + ['offline', 'WARNING'], + ['blocked', 'WARNING'], + ['failed', 'CRITICAL'], + ['non-raid', 'OK'], + ['removed', 'OK'], + ], + 'vdisk.state' => [ + ['unknown', 'UNKNOWN'], + ['online', 'OK'], + ['failed', 'CRITICAL'], + ['degraded', 'WARNING'], + ], }; - - # need also: fru, systemslot, storagectrl (storage controller), storagebattery - # physicaldisk, virtualdisk + $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']; + 'systembattery', 'coolingunit', 'coolingdevice', 'processor', 'memory', 'pci', 'network', + 'slot', 'fru', 'storagectrl', 'storagebattery', 'pdisk', 'vdisk']; + + $self->{regexp_threshold_overload_check_section_option} = + '^(' . join('|', @{$self->{components_module}}). ')$'; } sub snmp_execute { @@ -94,14 +112,16 @@ __END__ =head1 MODE -Check hardware components (temperatures,...). +Check hardware components. =over 8 =item B<--component> Which component to check (Default: '.*'). -Can be: 'temperature', +Can be: 'psu', 'punit', 'temperature', 'voltage', 'amperage', +'systembattery', 'coolingunit', 'coolingdevice', 'processor', 'memory', 'pci', 'network', +'slot', 'fru', 'storagectrl', 'storagebattery', 'pdisk', 'vdisk'. =item B<--filter> @@ -121,12 +141,12 @@ Example: --threshold-overload='temperature.state,CRITICAL,^(?!(enabled)$)' =item B<--warning> -Set warning threshold for temperature (syntax: type,regexp,treshold) +Set warning threshold (syntax: type,regexp,treshold) Example: --warning='temperature,.*,30' =item B<--critical> -Set critical threshold for temperature (syntax: type,regexp,treshold) +Set critical threshold (syntax: type,regexp,treshold) Example: --critical='temperature,.*,40' =back