diff --git a/storage/storagetek/sl/snmp/mode/components/cap.pm b/storage/storagetek/sl/snmp/mode/components/cap.pm new file mode 100644 index 000000000..19b1a5b6c --- /dev/null +++ b/storage/storagetek/sl/snmp/mode/components/cap.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::storagetek::sl::snmp::mode::components::cap; + +use strict; +use warnings; +use storage::storagetek::sl::snmp::mode::components::resources qw($map_status); + +my $mapping = { + slCapStatusEnum => { oid => '.1.3.6.1.4.1.1211.1.15.4.20.1.6', map => $map_status }, +}; +my $oid_slCapEntry = '.1.3.6.1.4.1.1211.1.15.4.20.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_slCapEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking cartridge access ports"); + $self->{components}->{cap} = {name => 'cap', total => 0, skip => 0}; + return if ($self->check_filter(section => 'cap')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_slCapEntry}})) { + next if ($oid !~ /^$mapping->{slCapStatusEnum}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_slCapEntry}, instance => $instance); + + next if ($self->check_filter(section => 'cap', instance => $instance)); + $self->{components}->{cap}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("cap '%s' status is '%s' [instance: %s].", + $instance, $result->{slCapStatusEnum}, + $instance + )); + my $exit = $self->get_severity(label => 'status', section => 'cap', value => $result->{slCapStatusEnum}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("cap '%s' status is '%s'", + $instance, $result->{slCapStatusEnum})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/storagetek/sl/snmp/mode/components/controller.pm b/storage/storagetek/sl/snmp/mode/components/controller.pm new file mode 100644 index 000000000..0ae0b6479 --- /dev/null +++ b/storage/storagetek/sl/snmp/mode/components/controller.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 storage::storagetek::sl::snmp::mode::components::controller; + +use strict; +use warnings; +use storage::storagetek::sl::snmp::mode::components::resources qw($map_status); + +my $mapping = { + slControllerSerialNum => { oid => '.1.3.6.1.4.1.1211.1.15.4.14.1.3' }, + slControllerStatus => { oid => '.1.3.6.1.4.1.1211.1.15.4.14.1.4', map => $map_status }, +}; +my $oid_slControllerEntry = '.1.3.6.1.4.1.1211.1.15.4.14.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_slControllerEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking controllers"); + $self->{components}->{controller} = {name => 'controllers', total => 0, skip => 0}; + return if ($self->check_filter(section => 'controller')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_slControllerEntry}})) { + next if ($oid !~ /^$mapping->{slControllerStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_slControllerEntry}, instance => $instance); + + next if ($self->check_filter(section => 'controller', instance => $instance)); + $self->{components}->{controller}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("controller '%s' status is '%s' [instance: %s].", + $result->{slControllerSerialNum}, $result->{slControllerStatus}, + $instance + )); + my $exit = $self->get_severity(label => 'status', section => 'controller', value => $result->{slControllerStatus}); + 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->{slControllerSerialNum}, $result->{slControllerStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/storagetek/sl/snmp/mode/components/elevator.pm b/storage/storagetek/sl/snmp/mode/components/elevator.pm new file mode 100644 index 000000000..baca22d62 --- /dev/null +++ b/storage/storagetek/sl/snmp/mode/components/elevator.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 storage::storagetek::sl::snmp::mode::components::elevator; + +use strict; +use warnings; +use storage::storagetek::sl::snmp::mode::components::resources qw($map_status); + +my $mapping = { + slElevatorSerialNum => { oid => '.1.3.6.1.4.1.1211.1.15.4.12.1.5' }, + slElevatorStatusEnum => { oid => '.1.3.6.1.4.1.1211.1.15.4.12.1.8', map => $map_status }, +}; +my $oid_slElevatorEntry = '.1.3.6.1.4.1.1211.1.15.4.12.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_slElevatorEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking elevators"); + $self->{components}->{elevator} = {name => 'elevators', total => 0, skip => 0}; + return if ($self->check_filter(section => 'elevator')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_slElevatorEntry}})) { + next if ($oid !~ /^$mapping->{slElevatorStatusEnum}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_slElevatorEntry}, instance => $instance); + + next if ($self->check_filter(section => 'elevator', instance => $instance)); + $self->{components}->{elevator}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("elevator '%s' status is '%s' [instance: %s].", + $result->{slElevatorSerialNum}, $result->{slElevatorStatusEnum}, + $instance + )); + my $exit = $self->get_severity(label => 'status', section => 'elevator', value => $result->{slElevatorStatusEnum}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Elevator '%s' status is '%s'", + $result->{slElevatorSerialNum}, $result->{slElevatorStatusEnum})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/storagetek/sl/snmp/mode/components/fan.pm b/storage/storagetek/sl/snmp/mode/components/fan.pm new file mode 100644 index 000000000..8bbdc8fdf --- /dev/null +++ b/storage/storagetek/sl/snmp/mode/components/fan.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 storage::storagetek::sl::snmp::mode::components::fan; + +use strict; +use warnings; +use storage::storagetek::sl::snmp::mode::components::resources qw($map_operational); + +my $mapping = { + slHdwFanName => { oid => '.1.3.6.1.4.1.1211.1.15.4.6.1.2' }, + slHdwFanOperational => { oid => '.1.3.6.1.4.1.1211.1.15.4.6.1.3', map => $map_operational }, +}; +my $oid_slHdwFanEntry = '.1.3.6.1.4.1.1211.1.15.4.6.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_slHdwFanEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking fans"); + $self->{components}->{fan} = {name => 'fans', total => 0, skip => 0}; + return if ($self->check_filter(section => 'fan')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_slHdwFanEntry}})) { + next if ($oid !~ /^$mapping->{slHdwFanOperational}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_slHdwFanEntry}, instance => $instance); + + next if ($self->check_filter(section => 'fan', instance => $instance)); + $self->{components}->{fan}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("fan '%s' status is '%s' [instance: %s].", + $result->{slHdwFanName}, $result->{slHdwFanOperational}, + $instance + )); + my $exit = $self->get_severity(label => 'operational', section => 'fan', value => $result->{slHdwFanOperational}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Fan '%s' status is '%s'", + $result->{slHdwFanName}, $result->{slHdwFanOperational})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/storagetek/sl/snmp/mode/components/interface.pm b/storage/storagetek/sl/snmp/mode/components/interface.pm new file mode 100644 index 000000000..1009c158b --- /dev/null +++ b/storage/storagetek/sl/snmp/mode/components/interface.pm @@ -0,0 +1,69 @@ +# +# 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::storagetek::sl::snmp::mode::components::interface; + +use strict; +use warnings; +use storage::storagetek::sl::snmp::mode::components::resources qw($map_status); + +my $mapping = { + slHostInterfaceAWWN => { oid => '.1.3.6.1.4.1.1211.1.15.4.2.1.3' }, + slHostInterfaceBWWN => { oid => '.1.3.6.1.4.1.1211.1.15.4.2.1.12' }, + slHostInterfaceStatusEnum => { oid => '.1.3.6.1.4.1.1211.1.15.4.2.1.26', map => $map_status }, +}; +my $oid_slHostInterfaceEntry = '.1.3.6.1.4.1.1211.1.15.4.2.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_slHostInterfaceEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking interfaces"); + $self->{components}->{interface} = {name => 'interfaces', total => 0, skip => 0}; + return if ($self->check_filter(section => 'interface')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_slHostInterfaceEntry}})) { + next if ($oid !~ /^$mapping->{slHostInterfaceStatusEnum}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_slHostInterfaceEntry}, instance => $instance); + + next if ($self->check_filter(section => 'interface', instance => $instance)); + $self->{components}->{interface}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("interface '%s/%s' status is '%s' [instance: %s].", + $result->{slHostInterfaceAWWN}, $result->{slHostInterfaceBWWN}, $result->{slHostInterfaceStatusEnum}, + $instance + )); + my $exit = $self->get_severity(label => 'status', section => 'interface', value => $result->{slHostInterfaceStatusEnum}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Interface '%s/%s' status is '%s'", + $result->{slHostInterfaceAWWN}, $result->{slHostInterfaceBWWN}, + $result->{slHostInterfaceStatusEnum})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/storagetek/sl/snmp/mode/components/psu.pm b/storage/storagetek/sl/snmp/mode/components/psu.pm new file mode 100644 index 000000000..3cf08b025 --- /dev/null +++ b/storage/storagetek/sl/snmp/mode/components/psu.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 storage::storagetek::sl::snmp::mode::components::psu; + +use strict; +use warnings; +use storage::storagetek::sl::snmp::mode::components::resources qw($map_operational); + +my $mapping = { + slHdwSupplyName => { oid => '.1.3.6.1.4.1.1211.1.15.4.8.1.2' }, + slHdwSupplyOperational => { oid => '.1.3.6.1.4.1.1211.1.15.4.8.1.4', map => $map_operational }, +}; +my $oid_slHdwSupplyEntry = '.1.3.6.1.4.1.1211.1.15.4.8.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_slHdwSupplyEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking power supplies"); + $self->{components}->{psu} = {name => 'psus', total => 0, skip => 0}; + return if ($self->check_filter(section => 'psu')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_slHdwSupplyEntry}})) { + next if ($oid !~ /^$mapping->{slHdwSupplyOperational}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_slHdwSupplyEntry}, instance => $instance); + + next if ($self->check_filter(section => 'psu', instance => $instance)); + $self->{components}->{psu}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("power supply '%s' status is '%s' [instance: %s].", + $result->{slHdwSupplyName}, $result->{slHdwSupplyOperational}, + $instance + )); + my $exit = $self->get_severity(label => 'operational', section => 'psu', value => $result->{slHdwSupplyOperational}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Power supply '%s' status is '%s'", + $result->{slHdwSupplyName}, $result->{slHdwSupplyOperational})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/storagetek/sl/snmp/mode/components/resources.pm b/storage/storagetek/sl/snmp/mode/components/resources.pm new file mode 100644 index 000000000..7f11ac901 --- /dev/null +++ b/storage/storagetek/sl/snmp/mode/components/resources.pm @@ -0,0 +1,46 @@ +# +# 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::storagetek::sl::snmp::mode::components::resources; + +use strict; +use warnings; +use Exporter; + +our $map_status; +our $map_operational; + +our @ISA = qw(Exporter); +our @EXPORT_OK = qw($map_status $map_operational); + +$map_operational = { + 1 => 'failed', + 2 => 'normal', +}; + +$map_status = { + 0 => 'ok', + 1 => 'error', + 2 => 'warning', + 3 => 'info', + 4 => 'trace', +}; + +1; \ No newline at end of file diff --git a/storage/storagetek/sl/snmp/mode/components/robot.pm b/storage/storagetek/sl/snmp/mode/components/robot.pm new file mode 100644 index 000000000..fcb0d51f8 --- /dev/null +++ b/storage/storagetek/sl/snmp/mode/components/robot.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 storage::storagetek::sl::snmp::mode::components::robot; + +use strict; +use warnings; +use storage::storagetek::sl::snmp::mode::components::resources qw($map_status); + +my $mapping = { + slRobotSerialNum => { oid => '.1.3.6.1.4.1.1211.1.15.4.10.1.5' }, + slRobotStatusEnum => { oid => '.1.3.6.1.4.1.1211.1.15.4.10.1.8', map => $map_status }, +}; +my $oid_slRobotEntry = '.1.3.6.1.4.1.1211.1.15.4.10.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_slRobotEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking robots"); + $self->{components}->{robot} = {name => 'robots', total => 0, skip => 0}; + return if ($self->check_filter(section => 'robot')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_slRobotEntry}})) { + next if ($oid !~ /^$mapping->{slRobotStatusEnum}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_slRobotEntry}, instance => $instance); + + next if ($self->check_filter(section => 'robot', instance => $instance)); + $self->{components}->{robot}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("robot '%s' status is '%s' [instance: %s].", + $result->{slRobotSerialNum}, $result->{slRobotStatusEnum}, + $instance + )); + my $exit = $self->get_severity(label => 'status', section => 'robot', value => $result->{slRobotStatusEnum}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Robot '%s' status is '%s'", + $result->{slRobotSerialNum}, $result->{slRobotStatusEnum})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/storagetek/sl/snmp/mode/components/temperature.pm b/storage/storagetek/sl/snmp/mode/components/temperature.pm new file mode 100644 index 000000000..3d8481604 --- /dev/null +++ b/storage/storagetek/sl/snmp/mode/components/temperature.pm @@ -0,0 +1,84 @@ +# +# 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::storagetek::sl::snmp::mode::components::temperature; + +use strict; +use warnings; + +my $mapping = { + slHdwTempSensorName => { oid => '.1.3.6.1.4.1.1211.1.15.4.4.1.2' }, + slHdwTempSensorCurrentTemp => { oid => '.1.3.6.1.4.1.1211.1.15.4.4.1.3' }, + slHdwTempSensorWarnThreshold => { oid => '.1.3.6.1.4.1.1211.1.15.4.4.1.5' }, + slHdwTempSensorFailThreshold => { oid => '.1.3.6.1.4.1.1211.1.15.4.4.1.6' }, +}; +my $oid_slHdwTempSensorEntry = '.1.3.6.1.4.1.1211.1.15.4.4.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_slHdwTempSensorEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking temperatures"); + $self->{components}->{temperature} = {name => 'temperatures', total => 0, skip => 0}; + return if ($self->check_filter(section => 'temperature')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_slHdwTempSensorEntry}})) { + next if ($oid !~ /^$mapping->{slHdwTempSensorCurrentTemp}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_slHdwTempSensorEntry}, instance => $instance); + + next if ($self->check_filter(section => 'temperature', instance => $instance)); + $self->{components}->{temperature}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("temperature '%s' is %s degree centigrade [instance = %s]", + $result->{slHdwTempSensorName}, $result->{slHdwTempSensorCurrentTemp}, $instance, + )); + + my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{slHdwTempSensorCurrentTemp}); + if ($checked == 0) { + my $warn_th = ':' . $result->{slHdwTempSensorWarnThreshold}; + my $crit_th = ':' . $result->{slHdwTempSensorFailThreshold}; + $self->{perfdata}->threshold_validate(label => 'warning-temperature-instance-' . $instance, value => $warn_th); + $self->{perfdata}->threshold_validate(label => 'critical-temperature-instance-' . $instance, value => $crit_th); + + $exit = $self->{perfdata}->threshold_check(value => $result->{slHdwTempSensorCurrentTemp}, threshold => [ { label => 'critical-temperature-instance-' . $instance, exit_litteral => 'critical' }, + { label => 'warning-temperature-instance-' . $instance, exit_litteral => 'warning' } ]); + $warn = $self->{perfdata}->get_perfdata_for_output(label => 'warning-temperature-instance-' . $instance); + $crit = $self->{perfdata}->get_perfdata_for_output(label => 'critical-temperature-instance-' . $instance); + } + + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Temperature '%s' is %s degree centigrade", $result->{slHdwTempSensorName}, $result->{slHdwTempSensorCurrentTemp})); + } + $self->{output}->perfdata_add(label => 'temp_' . $result->{slHdwTempSensorName}, unit => 'C', + value => $result->{slHdwTempSensorCurrentTemp}, + warning => $warn, + critical => $crit, + ); + } +} + +1; \ No newline at end of file diff --git a/storage/storagetek/sl/snmp/mode/components/turntable.pm b/storage/storagetek/sl/snmp/mode/components/turntable.pm new file mode 100644 index 000000000..083823ad5 --- /dev/null +++ b/storage/storagetek/sl/snmp/mode/components/turntable.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 storage::storagetek::sl::snmp::mode::components::turntable; + +use strict; +use warnings; +use storage::storagetek::sl::snmp::mode::components::resources qw($map_status); + +my $mapping = { + slTurntableSerialNum => { oid => '.1.3.6.1.4.1.1211.1.15.4.22.1.5' }, + slTurntableStatusEnum => { oid => '.1.3.6.1.4.1.1211.1.15.4.22.1.8', map => $map_status }, +}; +my $oid_slTurntableEntry = '.1.3.6.1.4.1.1211.1.15.4.22.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_slTurntableEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking turntables"); + $self->{components}->{turntable} = {name => 'turntables', total => 0, skip => 0}; + return if ($self->check_filter(section => 'turntable')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_slTurntableEntry}})) { + next if ($oid !~ /^$mapping->{slTurntableStatusEnum}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_slTurntableEntry}, instance => $instance); + + next if ($self->check_filter(section => 'turntable', instance => $instance)); + $self->{components}->{turntable}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("turntable '%s' status is '%s' [instance: %s].", + $result->{slTurntableSerialNum}, $result->{slTurntableStatusEnum}, + $instance + )); + my $exit = $self->get_severity(label => 'status', section => 'turntable', value => $result->{slTurntableStatusEnum}); + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Turntable '%s' status is '%s'", + $result->{slTurntableSerialNum}, $result->{slTurntableStatusEnum})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/storagetek/sl/snmp/mode/hardware.pm b/storage/storagetek/sl/snmp/mode/hardware.pm new file mode 100644 index 000000000..589d29755 --- /dev/null +++ b/storage/storagetek/sl/snmp/mode/hardware.pm @@ -0,0 +1,117 @@ +# +# 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::storagetek::sl::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} = '^(interface|temperature|fan|psu|robot|elevator|controller|cap|turntable)$'; + $self->{regexp_threshold_numeric_check_section_option} = '^(temperature)$'; + + $self->{cb_hook2} = 'snmp_execute'; + + $self->{thresholds} = { + status => [ + ['ok', 'OK'], + ['error', 'CRITICAL'], + ['warning', 'WARNING'], + ['info', 'OK'], + ['trace', 'OK'], + ], + operational => [ + ['normal', 'OK'], + ['failed', 'WARNING'], + ], + }; + + $self->{components_path} = 'storage::storagetek::sl::snmp::mode::components'; + $self->{components_module} = ['interface', 'temperature', 'fan', 'psu', 'robot', 'elevator', 'controller', 'cap', 'turntable']; +} + +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 hardware. + +=over 8 + +=item B<--component> + +Which component to check (Default: '.*'). +Can be: 'interface', 'temperature', 'fan', 'psu', 'robot', 'elevator', 'controller', 'cap', 'turntable'. + +=item B<--filter> + +Exclude some parts (comma seperated list) (Example: --filter=controller) +Can also exclude specific instance: --filter=cap,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='robot,CRITICAL,warning' + +=item B<--warning> + +Set warning threshold (syntax: type,regexp,threshold) +Example: --warning='temperature,.*,30' + +=item B<--critical> + +Set critical threshold (syntax: type,regexp,threshold) +Example: --critical='temperature,.*,40' + +=back + +=cut \ No newline at end of file diff --git a/storage/storagetek/sl/snmp/plugin.pm b/storage/storagetek/sl/snmp/plugin.pm new file mode 100644 index 000000000..bd26593bb --- /dev/null +++ b/storage/storagetek/sl/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::storagetek::sl::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::storagetek::sl::snmp::mode::hardware', + ); + + return $self; +} + +1; + +__END__ + +=head1 PLUGIN DESCRIPTION + +Check StorageTek SL Series (SL150, SL500, ...) in SNMP. + +=cut