From 504ff6d05830ac40884781d26fb68513d31da0ba Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Tue, 22 Mar 2016 15:25:20 +0100 Subject: [PATCH] + add a plugin for dell compellent sc in snmp (hardware) --- .../compellent/snmp/mode/components/cache.pm | 66 ++++++++++ .../compellent/snmp/mode/components/ctrl.pm | 66 ++++++++++ .../snmp/mode/components/ctrlfan.pm | 102 ++++++++++++++++ .../snmp/mode/components/ctrlpower.pm | 66 ++++++++++ .../snmp/mode/components/ctrltemp.pm | 101 ++++++++++++++++ .../snmp/mode/components/ctrlvoltage.pm | 101 ++++++++++++++++ .../compellent/snmp/mode/components/disk.pm | 66 ++++++++++ .../compellent/snmp/mode/components/encl.pm | 66 ++++++++++ .../snmp/mode/components/enclfan.pm | 66 ++++++++++ .../snmp/mode/components/encliomod.pm | 66 ++++++++++ .../snmp/mode/components/enclpower.pm | 66 ++++++++++ .../snmp/mode/components/encltemp.pm | 80 ++++++++++++ .../snmp/mode/components/resources.pm | 38 ++++++ .../compellent/snmp/mode/components/sc.pm | 66 ++++++++++ .../compellent/snmp/mode/components/server.pm | 66 ++++++++++ .../compellent/snmp/mode/components/volume.pm | 66 ++++++++++ storage/dell/compellent/snmp/mode/hardware.pm | 114 ++++++++++++++++++ storage/dell/compellent/snmp/plugin.pm | 48 ++++++++ 18 files changed, 1310 insertions(+) create mode 100644 storage/dell/compellent/snmp/mode/components/cache.pm create mode 100644 storage/dell/compellent/snmp/mode/components/ctrl.pm create mode 100644 storage/dell/compellent/snmp/mode/components/ctrlfan.pm create mode 100644 storage/dell/compellent/snmp/mode/components/ctrlpower.pm create mode 100644 storage/dell/compellent/snmp/mode/components/ctrltemp.pm create mode 100644 storage/dell/compellent/snmp/mode/components/ctrlvoltage.pm create mode 100644 storage/dell/compellent/snmp/mode/components/disk.pm create mode 100644 storage/dell/compellent/snmp/mode/components/encl.pm create mode 100644 storage/dell/compellent/snmp/mode/components/enclfan.pm create mode 100644 storage/dell/compellent/snmp/mode/components/encliomod.pm create mode 100644 storage/dell/compellent/snmp/mode/components/enclpower.pm create mode 100644 storage/dell/compellent/snmp/mode/components/encltemp.pm create mode 100644 storage/dell/compellent/snmp/mode/components/resources.pm create mode 100644 storage/dell/compellent/snmp/mode/components/sc.pm create mode 100644 storage/dell/compellent/snmp/mode/components/server.pm create mode 100644 storage/dell/compellent/snmp/mode/components/volume.pm create mode 100644 storage/dell/compellent/snmp/mode/hardware.pm create mode 100644 storage/dell/compellent/snmp/plugin.pm diff --git a/storage/dell/compellent/snmp/mode/components/cache.pm b/storage/dell/compellent/snmp/mode/components/cache.pm new file mode 100644 index 000000000..54e329b67 --- /dev/null +++ b/storage/dell/compellent/snmp/mode/components/cache.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 storage::dell::compellent::snmp::mode::components::cache; + +use strict; +use warnings; +use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status); + +my $mapping = { + scCacheStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.28.1.3', map => \%map_sc_status }, + scCacheName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.28.1.4' }, +}; +my $oid_scCacheEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.28.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_scCacheEntry, begin => $mapping->{scCacheStatus}->{oid}, end => $mapping->{scCacheName}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking caches"); + $self->{components}->{cache} = {name => 'caches', total => 0, skip => 0}; + return if ($self->check_filter(section => 'cache')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scCacheEntry}})) { + next if ($oid !~ /^$mapping->{scCacheStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scCacheEntry}, instance => $instance); + + next if ($self->check_filter(section => 'cache', instance => $instance)); + $self->{components}->{cache}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("cache '%s' status is '%s' [instance = %s]", + $result->{scCacheName}, $result->{scCacheStatus}, $instance, + )); + + my $exit = $self->get_severity(label => 'default', section => 'cache', value => $result->{scCacheStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Cache '%s' status is '%s'", $result->{scCacheName}, $result->{scCacheStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/dell/compellent/snmp/mode/components/ctrl.pm b/storage/dell/compellent/snmp/mode/components/ctrl.pm new file mode 100644 index 000000000..534a668bf --- /dev/null +++ b/storage/dell/compellent/snmp/mode/components/ctrl.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 storage::dell::compellent::snmp::mode::components::ctrl; + +use strict; +use warnings; +use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status); + +my $mapping = { + scCtlrStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.13.1.3', map => \%map_sc_status }, + scCtlrName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.13.1.4' }, +}; +my $oid_scCtlrEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.13.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_scCtlrEntry, begin => $mapping->{scCtlrStatus}->{oid}, end => $mapping->{scCtlrName}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking controllers"); + $self->{components}->{ctrl} = {name => 'controllers', total => 0, skip => 0}; + return if ($self->check_filter(section => 'ctrl')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scCtlrEntry}})) { + next if ($oid !~ /^$mapping->{scCtlrStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scCtlrEntry}, instance => $instance); + + next if ($self->check_filter(section => 'ctrl', instance => $instance)); + $self->{components}->{ctrl}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("controller '%s' status is '%s' [instance = %s]", + $result->{scCtlrName}, $result->{scCtlrStatus}, $instance, + )); + + my $exit = $self->get_severity(label => 'default', section => 'ctrl', value => $result->{scCtlrStatus}); + 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->{scCtlrName}, $result->{scCtlrStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/dell/compellent/snmp/mode/components/ctrlfan.pm b/storage/dell/compellent/snmp/mode/components/ctrlfan.pm new file mode 100644 index 000000000..f896432bd --- /dev/null +++ b/storage/dell/compellent/snmp/mode/components/ctrlfan.pm @@ -0,0 +1,102 @@ +# +# 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 storage::dell::compellent::snmp::mode::components::ctrlfan; + +use strict; +use warnings; +use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status); + +my $mapping = { + scCtlrFanStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1.3', map => \%map_sc_status }, + scCtlrFanName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1.4' }, + scCtlrFanCurrentRpm => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1.5' }, + scCtlrFanWarnLwrRpm => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1.8' }, + scCtlrFanWarnUprRpm => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1.9' }, + scCtlrFanCritLwrRpm => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1.10' }, + scCtlrFanCritUprRpm => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1.11' }, +}; +my $oid_scCtlrFanEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.16.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_scCtlrFanEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking controller fans"); + $self->{components}->{ctrlfan} = {name => 'controller fans', total => 0, skip => 0}; + return if ($self->check_filter(section => 'ctrlfan')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scCtlrFanEntry}})) { + next if ($oid !~ /^$mapping->{scCtlrFanStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scCtlrFanEntry}, instance => $instance); + + next if ($self->check_filter(section => 'ctrlfan', instance => $instance)); + + $self->{components}->{ctrlfan}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("controller fan '%s' status is '%s' [instance = %s] [value = %s]", + $result->{scCtlrFanName}, $result->{scCtlrFanStatus}, $instance, + $result->{scCtlrFanCurrentRpm})); + + my $exit = $self->get_severity(label => 'default', section => 'ctrlfan', value => $result->{scCtlrFanStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Controller fan '%s' status is '%s'", $result->{scCtlrFanName}, $result->{scCtlrFanStatus})); + } + + my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'ctrlfan', instance => $instance, value => $result->{scCtlrFanCurrentRpm}); + if ($checked == 0) { + $result->{scCtlrFanWarnLwrRpm} = (defined($result->{scCtlrFanWarnLwrRpm}) && $result->{scCtlrFanWarnLwrRpm} =~ /[0-9]/) ? + $result->{scCtlrFanWarnLwrRpm} : ''; + $result->{scCtlrFanCritLwrRpm} = (defined($result->{scCtlrFanCritLwrRpm}) && $result->{scCtlrFanCritLwrRpm} =~ /[0-9]/) ? + $result->{scCtlrFanCritLwrRpm} : ''; + $result->{scCtlrFanWarnUprRpm} = (defined($result->{scCtlrFanWarnUprRpm}) && $result->{scCtlrFanWarnUprRpm} =~ /[0-9]/) ? + $result->{scCtlrFanWarnUprRpm} : ''; + $result->{scCtlrFanCritUprRpm} = (defined($result->{scCtlrFanCritUprRpm}) && $result->{scCtlrFanCritUprRpm} =~ /[0-9]/) ? + $result->{scCtlrFanCritUprRpm} : ''; + my $warn_th = $result->{scCtlrFanWarnLwrRpm} . ':' . $result->{scCtlrFanWarnUprRpm}; + my $crit_th = $result->{scCtlrFanCritLwrRpm} . ':' . $result->{scCtlrFanCritUprRpm}; + $self->{perfdata}->threshold_validate(label => 'warning-ctrlfan-instance-' . $instance, value => $warn_th); + $self->{perfdata}->threshold_validate(label => 'critical-ctrlfan-instance-' . $instance, value => $crit_th); + + $warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-ctrlfan-instance-' . $instance); + $crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-ctrlfan-instance-' . $instance); + } + + if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit2, + short_msg => sprintf("Controller fan '%s' is %s rpm", $result->{scCtlrFanName}, $result->{scCtlrFanCurrentRpm})); + } + $self->{output}->perfdata_add(label => 'ctrlfan_' . $instance, unit => 'rpm', + value => $result->{scCtlrFanCurrentRpm}, + warning => $warn, + critical => $crit, + min => 0 + ); + } +} + +1; \ No newline at end of file diff --git a/storage/dell/compellent/snmp/mode/components/ctrlpower.pm b/storage/dell/compellent/snmp/mode/components/ctrlpower.pm new file mode 100644 index 000000000..cad63091e --- /dev/null +++ b/storage/dell/compellent/snmp/mode/components/ctrlpower.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 storage::dell::compellent::snmp::mode::components::ctrlpower; + +use strict; +use warnings; +use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status); + +my $mapping = { + scCtlrPowerStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.17.1.3', map => \%map_sc_status }, + scCtlrPowerName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.17.1.4' }, +}; +my $oid_scCtlrPowerEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.17.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_scCtlrPowerEntry, begin => $mapping->{scCtlrPowerStatus}->{oid}, end => $mapping->{scCtlrPowerName}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking controller power supplies"); + $self->{components}->{ctrlpower} = {name => 'controller psus', total => 0, skip => 0}; + return if ($self->check_filter(section => 'ctrlpower')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scCtlrPowerEntry}})) { + next if ($oid !~ /^$mapping->{scCtlrPowerStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scCtlrPowerEntry}, instance => $instance); + + next if ($self->check_filter(section => 'ctrlpower', instance => $instance)); + $self->{components}->{ctrlpower}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("controller power supply '%s' status is '%s' [instance = %s]", + $result->{scCtlrPowerName}, $result->{scCtlrPowerStatus}, $instance, + )); + + my $exit = $self->get_severity(label => 'default', section => 'ctrlpower', value => $result->{scCtlrPowerStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Controller power supply '%s' status is '%s'", $result->{scCtlrPowerName}, $result->{scCtlrPowerStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/dell/compellent/snmp/mode/components/ctrltemp.pm b/storage/dell/compellent/snmp/mode/components/ctrltemp.pm new file mode 100644 index 000000000..ef0d76f94 --- /dev/null +++ b/storage/dell/compellent/snmp/mode/components/ctrltemp.pm @@ -0,0 +1,101 @@ +# +# 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 storage::dell::compellent::snmp::mode::components::ctrltemp; + +use strict; +use warnings; +use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status); + +my $mapping = { + scCtlrTempStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1.3', map => \%map_sc_status }, + scCtlrTempName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1.4' }, + scCtlrTempCurrentC => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1.5' }, + scCtlrTempWarnLwrC => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1.8' }, + scCtlrTempWarnUprC => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1.9' }, + scCtlrTempCritLwrC => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1.10' }, + scCtlrTempCritUprC => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1.11' }, +}; +my $oid_scCtlrTempEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.19.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_scCtlrTempEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking controller temperatures"); + $self->{components}->{ctrltemp} = {name => 'controller temperatures', total => 0, skip => 0}; + return if ($self->check_filter(section => 'ctrltemp')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scCtlrTempEntry}})) { + next if ($oid !~ /^$mapping->{scCtlrTempStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scCtlrTempEntry}, instance => $instance); + + next if ($self->check_filter(section => 'ctrltemp', instance => $instance)); + + $self->{components}->{ctrltemp}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("controller temperature '%s' status is '%s' [instance = %s] [value = %s]", + $result->{scCtlrTempName}, $result->{scCtlrTempStatus}, $instance, + $result->{scCtlrTempCurrentC})); + + my $exit = $self->get_severity(label => 'default', section => 'ctrltemp', value => $result->{scCtlrTempStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Controller temperature '%s' status is '%s'", $result->{scCtlrTempName}, $result->{scCtlrTempStatus})); + } + + my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'ctrltemp', instance => $instance, value => $result->{scCtlrTempCurrentC}); + if ($checked == 0) { + $result->{scCtlrTempWarnLwrC} = (defined($result->{scCtlrTempWarnLwrC}) && $result->{scCtlrTempWarnLwrC} =~ /[0-9]/) ? + $result->{scCtlrTempWarnLwrC} : ''; + $result->{scCtlrTempCritLwrC} = (defined($result->{scCtlrTempCritLwrC}) && $result->{scCtlrTempCritLwrC} =~ /[0-9]/) ? + $result->{scCtlrTempCritLwrC} : ''; + $result->{scCtlrTempWarnUprC} = (defined($result->{scCtlrTempWarnUprC}) && $result->{scCtlrTempWarnUprC} =~ /[0-9]/) ? + $result->{scCtlrTempWarnUprC} : ''; + $result->{scCtlrTempCritUprC} = (defined($result->{scCtlrTempCritUprC}) && $result->{scCtlrTempCritUprC} =~ /[0-9]/) ? + $result->{scCtlrTempCritUprC} : ''; + my $warn_th = $result->{scCtlrTempWarnLwrC} . ':' . $result->{scCtlrTempWarnUprC}; + my $crit_th = $result->{scCtlrTempCritLwrC} . ':' . $result->{scCtlrTempCritUprC}; + $self->{perfdata}->threshold_validate(label => 'warning-ctrltemp-instance-' . $instance, value => $warn_th); + $self->{perfdata}->threshold_validate(label => 'critical-ctrltemp-instance-' . $instance, value => $crit_th); + + $warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-ctrltemp-instance-' . $instance); + $crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-ctrltemp-instance-' . $instance); + } + + if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit2, + short_msg => sprintf("Controller temperature '%s' is %s C", $result->{scCtlrTempName}, $result->{scCtlrTempCurrentC})); + } + $self->{output}->perfdata_add(label => 'ctrltemp_' . $instance, unit => 'C', + value => $result->{scCtlrTempCurrentC}, + warning => $warn, + critical => $crit, + ); + } +} + +1; \ No newline at end of file diff --git a/storage/dell/compellent/snmp/mode/components/ctrlvoltage.pm b/storage/dell/compellent/snmp/mode/components/ctrlvoltage.pm new file mode 100644 index 000000000..275e85220 --- /dev/null +++ b/storage/dell/compellent/snmp/mode/components/ctrlvoltage.pm @@ -0,0 +1,101 @@ +# +# 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 storage::dell::compellent::snmp::mode::components::ctrlvoltage; + +use strict; +use warnings; +use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status); + +my $mapping = { + scCtlrVoltageStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.18.1.3', map => \%map_sc_status }, + scCtlrVoltageName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.18.1.4' }, + scCtlrVoltageCurrentV => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.18.1.5' }, + scCtlrVoltageWarnLwrV => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.18.1.8' }, + scCtlrVoltageWarnUprV => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.18.1.9' }, + scCtlrVoltageCritLwrV => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.18.1.10' }, + scCtlrVoltageCritUprV => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.18.1.11' }, +}; +my $oid_scCtlrVoltageEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.18.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_scCtlrVoltageEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking controller voltages"); + $self->{components}->{ctrlvoltage} = {name => 'controller voltages', total => 0, skip => 0}; + return if ($self->check_filter(section => 'ctrlvoltage')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scCtlrVoltageEntry}})) { + next if ($oid !~ /^$mapping->{scCtlrVoltageStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scCtlrVoltageEntry}, instance => $instance); + + next if ($self->check_filter(section => 'ctrlvoltage', instance => $instance)); + + $self->{components}->{ctrlvoltage}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("controller voltage '%s' status is '%s' [instance = %s] [value = %s]", + $result->{scCtlrVoltageName}, $result->{scCtlrVoltageStatus}, $instance, + $result->{scCtlrVoltageCurrentV})); + + my $exit = $self->get_severity(label => 'default', section => 'ctrlvoltage', value => $result->{scCtlrVoltageStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Controller voltage '%s' status is '%s'", $result->{scCtlrVoltageName}, $result->{scCtlrVoltageStatus})); + } + + my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'ctrlvoltage', instance => $instance, value => $result->{scCtlrVoltageCurrentV}); + if ($checked == 0) { + $result->{scCtlrVoltageWarnLwrV} = (defined($result->{scCtlrVoltageWarnLwrV}) && $result->{scCtlrVoltageWarnLwrV} =~ /[0-9]/) ? + $result->{scCtlrVoltageWarnLwrV} : ''; + $result->{scCtlrVoltageCritLwrV} = (defined($result->{scCtlrVoltageCritLwrV}) && $result->{scCtlrVoltageCritLwrV} =~ /[0-9]/) ? + $result->{scCtlrVoltageCritLwrV} : ''; + $result->{scCtlrVoltageWarnUprV} = (defined($result->{scCtlrVoltageWarnUprV}) && $result->{scCtlrVoltageWarnUprV} =~ /[0-9]/) ? + $result->{scCtlrVoltageWarnUprV} : ''; + $result->{scCtlrVoltageCritUprV} = (defined($result->{scCtlrVoltageCritUprV}) && $result->{scCtlrVoltageCritUprV} =~ /[0-9]/) ? + $result->{scCtlrVoltageCritUprV} : ''; + my $warn_th = $result->{scCtlrVoltageWarnLwrV} . ':' . $result->{scCtlrVoltageWarnUprV}; + my $crit_th = $result->{scCtlrVoltageCritLwrV} . ':' . $result->{scCtlrVoltageCritUprV}; + $self->{perfdata}->threshold_validate(label => 'warning-ctrlvoltage-instance-' . $instance, value => $warn_th); + $self->{perfdata}->threshold_validate(label => 'critical-ctrlvoltage-instance-' . $instance, value => $crit_th); + + $warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-ctrlvoltage-instance-' . $instance); + $crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-ctrlvoltage-instance-' . $instance); + } + + if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit2, + short_msg => sprintf("Controller voltage '%s' is %s V", $result->{scCtlrVoltageName}, $result->{scCtlrVoltageCurrentV})); + } + $self->{output}->perfdata_add(label => 'ctrlvoltage_' . $instance, unit => 'V', + value => $result->{scCtlrVoltageCurrentV}, + warning => $warn, + critical => $crit, + ); + } +} + +1; \ No newline at end of file diff --git a/storage/dell/compellent/snmp/mode/components/disk.pm b/storage/dell/compellent/snmp/mode/components/disk.pm new file mode 100644 index 000000000..e8ac28059 --- /dev/null +++ b/storage/dell/compellent/snmp/mode/components/disk.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 storage::dell::compellent::snmp::mode::components::disk; + +use strict; +use warnings; +use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status); + +my $mapping = { + scDiskStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.14.1.3', map => \%map_sc_status }, + scDiskNamePosition => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.14.1.4' }, +}; +my $oid_scDiskEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.14.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_scDiskEntry, begin => $mapping->{scDiskStatus}->{oid}, end => $mapping->{scDiskNamePosition}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking disks"); + $self->{components}->{disk} = {name => 'disks', total => 0, skip => 0}; + return if ($self->check_filter(section => 'disk')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scDiskEntry}})) { + next if ($oid !~ /^$mapping->{scDiskStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scDiskEntry}, instance => $instance); + + next if ($self->check_filter(section => 'disk', instance => $instance)); + $self->{components}->{disk}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("disk '%s' status is '%s' [instance = %s]", + $result->{scDiskNamePosition}, $result->{scDiskStatus}, $instance, + )); + + my $exit = $self->get_severity(label => 'default', section => 'disk', value => $result->{scDiskStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Disk '%s' status is '%s'", $result->{scDiskNamePosition}, $result->{scDiskStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/dell/compellent/snmp/mode/components/encl.pm b/storage/dell/compellent/snmp/mode/components/encl.pm new file mode 100644 index 000000000..19e85cb00 --- /dev/null +++ b/storage/dell/compellent/snmp/mode/components/encl.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 storage::dell::compellent::snmp::mode::components::encl; + +use strict; +use warnings; +use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status); + +my $mapping = { + scEnclStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.15.1.3', map => \%map_sc_status }, + scEnclName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.15.1.4' }, +}; +my $oid_scEnclEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.15.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_scEnclEntry, begin => $mapping->{scEnclStatus}->{oid}, end => $mapping->{scEnclName}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking enclosures"); + $self->{components}->{encl} = {name => 'enclosures', total => 0, skip => 0}; + return if ($self->check_filter(section => 'encl')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scEnclEntry}})) { + next if ($oid !~ /^$mapping->{scEnclStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scEnclEntry}, instance => $instance); + + next if ($self->check_filter(section => 'encl', instance => $instance)); + $self->{components}->{encl}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("enclosure '%s' status is '%s' [instance = %s]", + $result->{scEnclName}, $result->{scEnclStatus}, $instance, + )); + + my $exit = $self->get_severity(label => 'default', section => 'encl', value => $result->{scEnclStatus}); + 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->{scEnclName}, $result->{scEnclStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/dell/compellent/snmp/mode/components/enclfan.pm b/storage/dell/compellent/snmp/mode/components/enclfan.pm new file mode 100644 index 000000000..9794bc204 --- /dev/null +++ b/storage/dell/compellent/snmp/mode/components/enclfan.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 storage::dell::compellent::snmp::mode::components::enclfan; + +use strict; +use warnings; +use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status); + +my $mapping = { + scEnclFanStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.20.1.3', map => \%map_sc_status }, + scEnclFanLocation => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.20.1.4' }, +}; +my $oid_scEnclFanEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.20.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_scEnclFanEntry, begin => $mapping->{scEnclFanStatus}->{oid}, end => $mapping->{scEnclFanLocation}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking enclosure fans"); + $self->{components}->{enclfan} = {name => 'enclosure fans', total => 0, skip => 0}; + return if ($self->check_filter(section => 'enclfan')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scEnclFanEntry}})) { + next if ($oid !~ /^$mapping->{scEnclFanStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scEnclFanEntry}, instance => $instance); + + next if ($self->check_filter(section => 'enclfan', instance => $instance)); + $self->{components}->{enclfan}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("enclosure fan '%s' status is '%s' [instance = %s]", + $result->{scEnclFanLocation}, $result->{scEnclFanStatus}, $instance, + )); + + my $exit = $self->get_severity(label => 'default', section => 'enclfan', value => $result->{scEnclFanStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Enclosure fan '%s' status is '%s'", $result->{scEnclFanLocation}, $result->{scEnclFanStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/dell/compellent/snmp/mode/components/encliomod.pm b/storage/dell/compellent/snmp/mode/components/encliomod.pm new file mode 100644 index 000000000..5bbcbd137 --- /dev/null +++ b/storage/dell/compellent/snmp/mode/components/encliomod.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 storage::dell::compellent::snmp::mode::components::encliomod; + +use strict; +use warnings; +use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status); + +my $mapping = { + scEnclIoModStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.22.1.3', map => \%map_sc_status }, + scEnclIoModPosition => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.22.1.4' }, +}; +my $oid_scEnclIoModEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.22.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_scEnclIoModEntry, begin => $mapping->{scEnclIoModStatus}->{oid}, end => $mapping->{scEnclIoModPosition}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking enclosure I/O modules"); + $self->{components}->{encliomod} = {name => 'enclosure I/O modules', total => 0, skip => 0}; + return if ($self->check_filter(section => 'encliomod')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scEnclIoModEntry}})) { + next if ($oid !~ /^$mapping->{scEnclIoModStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scEnclIoModEntry}, instance => $instance); + + next if ($self->check_filter(section => 'encliomod', instance => $instance)); + $self->{components}->{encliomod}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("enclosure I/O module '%s' status is '%s' [instance = %s]", + $result->{scEnclIoModPosition}, $result->{scEnclIoModStatus}, $instance, + )); + + my $exit = $self->get_severity(label => 'default', section => 'encliomod', value => $result->{scEnclIoModStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Enclosure I/O module '%s' status is '%s'", $result->{scEnclIoModPosition}, $result->{scEnclIoModStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/dell/compellent/snmp/mode/components/enclpower.pm b/storage/dell/compellent/snmp/mode/components/enclpower.pm new file mode 100644 index 000000000..36105d2ba --- /dev/null +++ b/storage/dell/compellent/snmp/mode/components/enclpower.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 storage::dell::compellent::snmp::mode::components::enclpower; + +use strict; +use warnings; +use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status); + +my $mapping = { + scEnclPowerStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.21.1.3', map => \%map_sc_status }, + scEnclPowerPosition => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.21.1.4' }, +}; +my $oid_scEnclPowerEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.21.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_scEnclPowerEntry, begin => $mapping->{scEnclPowerStatus}->{oid}, end => $mapping->{scEnclPowerPosition}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking enclosure power supplies"); + $self->{components}->{enclpower} = {name => 'enclosure psus', total => 0, skip => 0}; + return if ($self->check_filter(section => 'enclpower')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scEnclPowerEntry}})) { + next if ($oid !~ /^$mapping->{scEnclPowerStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scEnclPowerEntry}, instance => $instance); + + next if ($self->check_filter(section => 'enclpower', instance => $instance)); + $self->{components}->{enclpower}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("enclosure power supply '%s' status is '%s' [instance = %s]", + $result->{scEnclPowerPosition}, $result->{scEnclPowerStatus}, $instance, + )); + + my $exit = $self->get_severity(label => 'default', section => 'enclpower', value => $result->{scEnclPowerStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Enclosure power supply '%s' status is '%s'", $result->{scEnclPowerPosition}, $result->{scEnclPowerStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/dell/compellent/snmp/mode/components/encltemp.pm b/storage/dell/compellent/snmp/mode/components/encltemp.pm new file mode 100644 index 000000000..0c60642c1 --- /dev/null +++ b/storage/dell/compellent/snmp/mode/components/encltemp.pm @@ -0,0 +1,80 @@ +# +# 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 storage::dell::compellent::snmp::mode::components::encltemp; + +use strict; +use warnings; +use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status); + +my $mapping = { + scEnclTempStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.23.1.3', map => \%map_sc_status }, + scEnclTempLocation => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.23.1.4' }, + scEnclTempCurrentC => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.23.1.5' }, +}; +my $oid_scEnclTempEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.23.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_scEnclTempEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking enclosure temperatures"); + $self->{components}->{encltemp} = {name => 'enclosure temperatures', total => 0, skip => 0}; + return if ($self->check_filter(section => 'encltemp')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scEnclTempEntry}})) { + next if ($oid !~ /^$mapping->{scEnclTempStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scEnclTempEntry}, instance => $instance); + + next if ($self->check_filter(section => 'encltemp', instance => $instance)); + + $self->{components}->{encltemp}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("enclosure temperature '%s' status is '%s' [instance = %s] [value = %s]", + $result->{scEnclTempLocation}, $result->{scEnclTempStatus}, $instance, + $result->{scEnclTempCurrentC})); + + my $exit = $self->get_severity(label => 'default', section => 'encltemp', value => $result->{scEnclTempStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Enclosure temperature '%s' status is '%s'", $result->{scEnclTempLocation}, $result->{scEnclTempStatus})); + } + + my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'encltemp', instance => $instance, value => $result->{scEnclTempCurrentC}); + + if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit2, + short_msg => sprintf("Enclosure temperature '%s' is %s C", $result->{scEnclTempLocation}, $result->{scEnclTempCurrentC})); + } + $self->{output}->perfdata_add(label => 'encltemp_' . $instance, unit => 'C', + value => $result->{scEnclTempCurrentC}, + warning => $warn, + critical => $crit, + ); + } +} + +1; \ No newline at end of file diff --git a/storage/dell/compellent/snmp/mode/components/resources.pm b/storage/dell/compellent/snmp/mode/components/resources.pm new file mode 100644 index 000000000..206e7dbf4 --- /dev/null +++ b/storage/dell/compellent/snmp/mode/components/resources.pm @@ -0,0 +1,38 @@ +# +# 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 storage::dell::compellent::snmp::mode::components::resources; + +use strict; +use warnings; +use Exporter; + +our %map_sc_status; + +our @ISA = qw(Exporter); +our @EXPORT_OK = qw(%map_sc_status); + +%map_sc_status = ( + 1 => 'up', + 2 => 'down', + 3 => 'degraded', +); + +1; \ No newline at end of file diff --git a/storage/dell/compellent/snmp/mode/components/sc.pm b/storage/dell/compellent/snmp/mode/components/sc.pm new file mode 100644 index 000000000..fcb4ec115 --- /dev/null +++ b/storage/dell/compellent/snmp/mode/components/sc.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 storage::dell::compellent::snmp::mode::components::sc; + +use strict; +use warnings; +use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status); + +my $mapping = { + scScStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.29.1.3', map => \%map_sc_status }, + scScName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.29.1.4' }, +}; +my $oid_scScEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.29.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_scScEntry, begin => $mapping->{scScStatus}->{oid}, end => $mapping->{scScName}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking storage centers"); + $self->{components}->{sc} = {name => 'storage centers', total => 0, skip => 0}; + return if ($self->check_filter(section => 'sc')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scScEntry}})) { + next if ($oid !~ /^$mapping->{scScStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scScEntry}, instance => $instance); + + next if ($self->check_filter(section => 'sc', instance => $instance)); + $self->{components}->{sc}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("storage center '%s' status is '%s' [instance = %s]", + $result->{scScName}, $result->{scScStatus}, $instance, + )); + + my $exit = $self->get_severity(label => 'default', section => 'sc', value => $result->{scScStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Storage center '%s' status is '%s'", $result->{scScName}, $result->{scScStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/dell/compellent/snmp/mode/components/server.pm b/storage/dell/compellent/snmp/mode/components/server.pm new file mode 100644 index 000000000..802ca7c8e --- /dev/null +++ b/storage/dell/compellent/snmp/mode/components/server.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 storage::dell::compellent::snmp::mode::components::server; + +use strict; +use warnings; +use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status); + +my $mapping = { + scServerStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.27.1.3', map => \%map_sc_status }, + scServerName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.27.1.4' }, +}; +my $oid_scServerEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.27.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_scServerEntry, begin => $mapping->{scServerStatus}->{oid}, end => $mapping->{scServerName}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking servers"); + $self->{components}->{server} = {name => 'servers', total => 0, skip => 0}; + return if ($self->check_filter(section => 'server')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scServerEntry}})) { + next if ($oid !~ /^$mapping->{scServerStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scServerEntry}, instance => $instance); + + next if ($self->check_filter(section => 'server', instance => $instance)); + $self->{components}->{server}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("server '%s' status is '%s' [instance = %s]", + $result->{scServerName}, $result->{scServerStatus}, $instance, + )); + + my $exit = $self->get_severity(label => 'default', section => 'server', value => $result->{scServerStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Server '%s' status is '%s'", $result->{scServerName}, $result->{scServerStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/dell/compellent/snmp/mode/components/volume.pm b/storage/dell/compellent/snmp/mode/components/volume.pm new file mode 100644 index 000000000..6e31d56b4 --- /dev/null +++ b/storage/dell/compellent/snmp/mode/components/volume.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 storage::dell::compellent::snmp::mode::components::volume; + +use strict; +use warnings; +use storage::dell::compellent::snmp::mode::components::resources qw(%map_sc_status); + +my $mapping = { + scVolumeStatus => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.26.1.3', map => \%map_sc_status }, + scVolumeName => { oid => '.1.3.6.1.4.1.674.11000.2000.500.1.2.26.1.4' }, +}; +my $oid_scVolumeEntry = '.1.3.6.1.4.1.674.11000.2000.500.1.2.26.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_scVolumeEntry, begin => $mapping->{scVolumeStatus}->{oid}, end => $mapping->{scVolumeName}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking volumes"); + $self->{components}->{volume} = {name => 'volumes', total => 0, skip => 0}; + return if ($self->check_filter(section => 'volume')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_scVolumeEntry}})) { + next if ($oid !~ /^$mapping->{scVolumeStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_scVolumeEntry}, instance => $instance); + + next if ($self->check_filter(section => 'volume', instance => $instance)); + $self->{components}->{volume}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("volume '%s' status is '%s' [instance = %s]", + $result->{scVolumeName}, $result->{scVolumeStatus}, $instance, + )); + + my $exit = $self->get_severity(label => 'default', section => 'volume', value => $result->{scVolumeStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Volume '%s' status is '%s'", $result->{scVolumeName}, $result->{scVolumeStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/dell/compellent/snmp/mode/hardware.pm b/storage/dell/compellent/snmp/mode/hardware.pm new file mode 100644 index 000000000..e09232baa --- /dev/null +++ b/storage/dell/compellent/snmp/mode/hardware.pm @@ -0,0 +1,114 @@ +# +# 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 storage::dell::compellent::snmp::mode::hardware; + +use base qw(centreon::plugins::templates::hardware); + +use strict; +use warnings; + +sub set_system { + my ($self, %options) = @_; + + $self->{regexp_threshold_overload_check_section_option} = + '^(ctrl|disk|encl|ctrlfan|ctrlpower|ctrlvoltage|ctrltemp|enclfan|enclpower|encliomod|encltemp|volume|cache|server|sc)$'; + $self->{regexp_threshold_numeric_check_section_option} = '^(ctrltemp|ctrlvoltage|ctrlfan|encltemp)$'; + + $self->{cb_hook2} = 'snmp_execute'; + + $self->{thresholds} = { + default => [ + ['up', 'OK'], + ['down', 'CRITICAL'], + ['degraded', 'WARNING'], + ], + }; + + $self->{components_path} = 'storage::dell::compellent::snmp::mode::components'; + $self->{components_module} = ['ctrl', 'disk', 'ctrlfan', 'ctrlpower', 'ctrlvoltage', 'ctrltemp', + 'encl', 'enclfan', 'enclpower', 'encliomod', 'encltemp', 'volume', 'cache', 'server', 'sc']; +} + +sub snmp_execute { + my ($self, %options) = @_; + + $self->{snmp} = $options{snmp}; + $self->{results} = $self->{snmp}->get_multiple_table(oids => $self->{request}); +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options, no_absent => 1); + bless $self, $class; + + $self->{version} = '1.0'; + $options{options}->add_options(arguments => + { + }); + + return $self; +} + +1; + +__END__ + +=head1 MODE + +Check sensors. + +=over 8 + +=item B<--component> + +Which component to check (Default: '.*'). +Can be: 'ctrl', 'disk', 'encl', 'ctrlfan', 'ctrlpower', 'ctrlvoltage', +'ctrltemp', 'enclfan', 'enclpower', 'encliomod', 'encltemp', 'volume', 'cache', 'server', 'sc'. + +=item B<--filter> + +Exclude some parts (comma seperated list) (Example: --filter=ctrlfan --filter=enclpower) +Can also exclude specific instance: --filter=ctrlfan,1 + +=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,[instance,]status,regexp) +It used before default thresholds (order stays). +Example: --threshold-overload='ctrl,CRITICAL,^(?!(up)$)' + +=item B<--warning> + +Set warning threshold for 'ctrltemp', 'ctrlfan', 'ctrlvoltage', 'encltemp' (syntax: type,regexp,threshold) +Example: --warning='ctrltemp,1,30' + +=item B<--critical> + +Set critical threshold for 'ctrltemp', 'ctrlfan', 'ctrlvoltage', 'encltemp' (syntax: type,regexp,threshold) +Example: --critical='ctrltemp,1,50' + +=back + +=cut \ No newline at end of file diff --git a/storage/dell/compellent/snmp/plugin.pm b/storage/dell/compellent/snmp/plugin.pm new file mode 100644 index 000000000..c9afbb898 --- /dev/null +++ b/storage/dell/compellent/snmp/plugin.pm @@ -0,0 +1,48 @@ +# +# 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 storage::dell::compellent::snmp::plugin; + +use strict; +use warnings; +use base qw(centreon::plugins::script_snmp); + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $self->{version} = '1.0'; + %{$self->{modes}} = ( + 'hardware' => 'storage::dell::compellent::snmp::mode::hardware', + ); + + return $self; +} + +1; + +__END__ + +=head1 PLUGIN DESCRIPTION + +Check Dell Compellent in SNMP. + +=cut