diff --git a/centreon/common/adic/tape/snmp/mode/components/global.pm b/centreon/common/adic/tape/snmp/mode/components/global.pm new file mode 100644 index 000000000..009adf378 --- /dev/null +++ b/centreon/common/adic/tape/snmp/mode/components/global.pm @@ -0,0 +1,75 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package centreon::common::adic::tape::snmp::mode::components::global; + +use strict; +use warnings; + +my %map_status = ( + 1 => 'good', + 2 => 'failed', + 3 => 'degraded', + 4 => 'warning', + 5 => 'informational', + 6 => 'unknown', + 7 => 'invalid', +); + +# In MIB 'ADIC-TAPE-LIBRARY-MIB' +my $mapping = { + libraryGlobalStatus => { oid => '.1.3.6.1.4.1.3764.1.10.10.1.8', map => \%map_status }, +}; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $mapping->{libraryGlobalStatus}->{oid} }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking global"); + $self->{components}->{global} = {name => 'global', total => 0, skip => 0}; + return if ($self->check_filter(section => 'global')); + + my $instance = '0'; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$mapping->{libraryGlobalStatus}->{oid}}, instance => $instance); + if (!defined($result->{libraryGlobalStatus})) { + $self->{output}->output_add(long_msg => "skipping global status: no value."); + return ; + } + + return if ($self->check_filter(section => 'global', instance => $instance)); + $self->{components}->{physicaldrive}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("library global status is %s [instance: %s].", + $result->{libraryGlobalStatus}, $instance + )); + my $exit = $self->get_severity(section => 'global', label => 'default', value => $result->{libraryGlobalStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Library global status is %s", + $result->{libraryGlobalStatus})); + } +} + +1; \ No newline at end of file diff --git a/centreon/common/adic/tape/snmp/mode/components/physicaldrive.pm b/centreon/common/adic/tape/snmp/mode/components/physicaldrive.pm new file mode 100644 index 000000000..3fea6962c --- /dev/null +++ b/centreon/common/adic/tape/snmp/mode/components/physicaldrive.pm @@ -0,0 +1,78 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package centreon::common::adic::tape::snmp::mode::components::physicaldrive; + +use strict; +use warnings; + +my %map_status = ( + 1 => 'good', + 2 => 'failed', + 3 => 'degraded', + 4 => 'warning', + 5 => 'informational', + 6 => 'unknown', + 7 => 'invalid', +); + +# In MIB 'ADIC-TAPE-LIBRARY-MIB' +my $mapping = { + phDriveSerialNumber => { oid => '.1.3.6.1.4.1.3764.1.10.10.11.3.1.2' }, + phDriveModel => { oid => '.1.3.6.1.4.1.3764.1.10.10.11.3.1.3' }, + phDriveRasStatus => { oid => '.1.3.6.1.4.1.3764.1.10.10.11.3.1.11', map => \%map_status }, +}; +my $oid_physicalDriveEntry = '.1.3.6.1.4.1.3764.1.10.10.11.3.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_physicalDriveEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking physical drives"); + $self->{components}->{physicaldrive} = {name => 'physical drives', total => 0, skip => 0}; + return if ($self->check_filter(section => 'physicaldrive')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_physicalDriveEntry}})) { + next if ($oid !~ /^$mapping->{phDriveRasStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_physicalDriveEntry}, instance => $instance); + + next if ($self->check_filter(section => 'physicaldrive', instance => $instance)); + $self->{components}->{physicaldrive}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("physical drive '%s' status is %s [instance: %s, model: %s, serial: %s].", + $instance, $result->{phDriveRasStatus}, + $instance, $result->{phDriveModel}, $result->{phDriveSerialNumber} + )); + my $exit = $self->get_severity(section => 'physicaldrive', label => 'default', value => $result->{phDriveRasStatus}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Physical drive '%s' status is %s", + $instance, $result->{phDriveRasStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/centreon/common/adic/tape/snmp/mode/components/subsystem.pm b/centreon/common/adic/tape/snmp/mode/components/subsystem.pm new file mode 100644 index 000000000..1e7c634d3 --- /dev/null +++ b/centreon/common/adic/tape/snmp/mode/components/subsystem.pm @@ -0,0 +1,84 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package centreon::common::adic::tape::snmp::mode::components::subsystem; + +use strict; +use warnings; + +my %map_status = ( + 1 => 'good', + 2 => 'failed', + 3 => 'degraded', + 4 => 'warning', + 5 => 'informational', + 6 => 'unknown', + 7 => 'invalid', +); + +# In MIB 'ADIC-TAPE-LIBRARY-MIB' +my $mapping = { + powerStatus => { oid => '.1.3.6.1.4.1.3764.1.10.10.12.1', map => \%map_status, label => 'power', instance => 1 }, + coolingStatus => { oid => '.1.3.6.1.4.1.3764.1.10.10.12.2', map => \%map_status, label => 'cooling', instance => 2 }, + controlStatus => { oid => '.1.3.6.1.4.1.3764.1.10.10.12.3', map => \%map_status, label => 'control', instance => 3 }, + connectivityStatus => { oid => '.1.3.6.1.4.1.3764.1.10.10.12.4', map => \%map_status, label => 'connectivity', instance => 4 }, + roboticsStatus => { oid => '.1.3.6.1.4.1.3764.1.10.10.12.5', map => \%map_status, label => 'robotics', instance => 5 }, + mediaStatus => { oid => '.1.3.6.1.4.1.3764.1.10.10.12.6', map => \%map_status, label => 'media', instance => 6 }, + driveStatus => { oid => '.1.3.6.1.4.1.3764.1.10.10.12.6', map => \%map_status, label => 'drive', instance => 7 }, +}; +my $oid_rasSubSystem = '.1.3.6.1.4.1.3764.1.10.10.12'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_rasSubSystem }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking subsystems"); + $self->{components}->{subsystem} = {name => 'subsystems', total => 0, skip => 0}; + return if ($self->check_filter(section => 'subsystem')); + + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_rasSubSystem}, instance => '0'); + foreach my $name (keys %$mapping) { + if (!defined($result->{$name})) { + $self->{output}->output_add(long_msg => sprintf("skipping %s status: no value.", $mapping->{$name}->{label})); + next; + } + + next if ($self->check_filter(section => 'subsystem', instance => $mapping->{$name}->{instance})); + $self->{components}->{physicaldrive}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("%s status is %s [instance: %s].", + $mapping->{$name}->{label}, $result->{$name}, + $mapping->{$name}->{instance} + )); + my $exit = $self->get_severity(section => 'subsystem', label => 'default', value => $result->{$name}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("%s status is %s", + ucfirst($mapping->{$name}->{label}), $result->{$name})); + } + } +} + +1; \ No newline at end of file diff --git a/centreon/common/adic/tape/snmp/mode/hardware.pm b/centreon/common/adic/tape/snmp/mode/hardware.pm new file mode 100644 index 000000000..c2d2e45ad --- /dev/null +++ b/centreon/common/adic/tape/snmp/mode/hardware.pm @@ -0,0 +1,104 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package centreon::common::adic::tape::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} = '^(global|physicaldrive|subsystem)$'; + + $self->{cb_hook2} = 'snmp_execute'; + + $self->{thresholds} = { + default => [ + ['good', 'OK'], + ['failed', 'CRITICAL'], + ['degraded', 'WARNING'], + ['warning', 'WARNING'], + ['informational', 'OK'], + ['unknown', 'UNKNOWN'], + ['invalid', 'CRITICAL'], + ], + }; + + $self->{components_path} = 'centreon::common::adic::tape::snmp::mode::components'; + $self->{components_module} = ['global', 'physicaldrive', 'subsystem']; +} + +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_performance => 1, no_absent => 1); + bless $self, $class; + + $self->{version} = '1.0'; + $options{options}->add_options(arguments => + { + }); + + return $self; +} + +1; + +__END__ + +=head1 MODE + +Check Hardware (Power Supplies). + +=over 8 + +=item B<--component> + +Which component to check (Default: '.*'). +Can be: 'global', 'physicaldrive', 'subsystem'. + +=item B<--filter> + +Exclude some parts (comma seperated list) (Example: --filter=subsystem) +Can also exclude specific instance: --filter=physicaldrive,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='physicaldrive,OK,invalid' + +=back + +=cut \ No newline at end of file diff --git a/storage/dell/ml6000/snmp/plugin.pm b/storage/dell/ml6000/snmp/plugin.pm new file mode 100644 index 000000000..b053f3500 --- /dev/null +++ b/storage/dell/ml6000/snmp/plugin.pm @@ -0,0 +1,49 @@ +# +# Copyright 2015 Centreon (http://www.centreon.com/) +# +# Centreon is a full-fledged industry-strength solution that meets +# the needs in IT infrastructure and application monitoring for +# service performance. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +package storage::dell::ml6000::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; + # $options->{options} = options object + + $self->{version} = '1.0'; + %{$self->{modes}} = ( + 'hardware' => 'centreon::common::adic::tape::snmp::mode::hardware', + ); + + return $self; +} + +1; + +__END__ + +=head1 PLUGIN DESCRIPTION + +Check Dell ML6000 in SNMP. + +=cut