From 6c3d4c82460525833e2851a3be1792d3cc8d92db Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Mon, 21 Nov 2016 15:33:18 +0100 Subject: [PATCH] add plugin isilon snmp --- storage/emc/isilon/snmp/mode/clusterusage.pm | 292 ++++++++++++++++++ .../emc/isilon/snmp/mode/components/disk.pm | 68 ++++ .../emc/isilon/snmp/mode/components/fan.pm | 73 +++++ .../emc/isilon/snmp/mode/components/power.pm | 73 +++++ .../snmp/mode/components/temperature.pm | 73 +++++ storage/emc/isilon/snmp/mode/hardware.pm | 113 +++++++ storage/emc/isilon/snmp/plugin.pm | 49 +++ 7 files changed, 741 insertions(+) create mode 100644 storage/emc/isilon/snmp/mode/clusterusage.pm create mode 100644 storage/emc/isilon/snmp/mode/components/disk.pm create mode 100644 storage/emc/isilon/snmp/mode/components/fan.pm create mode 100644 storage/emc/isilon/snmp/mode/components/power.pm create mode 100644 storage/emc/isilon/snmp/mode/components/temperature.pm create mode 100644 storage/emc/isilon/snmp/mode/hardware.pm create mode 100644 storage/emc/isilon/snmp/plugin.pm diff --git a/storage/emc/isilon/snmp/mode/clusterusage.pm b/storage/emc/isilon/snmp/mode/clusterusage.pm new file mode 100644 index 000000000..344014926 --- /dev/null +++ b/storage/emc/isilon/snmp/mode/clusterusage.pm @@ -0,0 +1,292 @@ +# +# 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::emc::isilon::snmp::mode::clusterusage; + +use base qw(centreon::plugins::templates::counter); + +use strict; +use warnings; + +my $instance_mode; + +sub custom_status_threshold { + my ($self, %options) = @_; + my $status = 'ok'; + my $message; + + eval { + local $SIG{__WARN__} = sub { $message = $_[0]; }; + local $SIG{__DIE__} = sub { $message = $_[0]; }; + + if (defined($instance_mode->{option_results}->{critical_status}) && $instance_mode->{option_results}->{critical_status} ne '' && + eval "$instance_mode->{option_results}->{critical_status}") { + $status = 'critical'; + } elsif (defined($instance_mode->{option_results}->{warning_status}) && $instance_mode->{option_results}->{warning_status} ne '' && + eval "$instance_mode->{option_results}->{warning_status}") { + $status = 'warning'; + } + }; + if (defined($message)) { + $self->{output}->output_add(long_msg => 'filter status issue: ' . $message); + } + + return $status; +} + +sub custom_status_output { + my ($self, %options) = @_; + + my $msg = 'status: ' . $self->{result_values}->{status}; + return $msg; +} + +sub custom_status_calc { + my ($self, %options) = @_; + + $self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_status'}; + return 0; +} + +sub custom_usage_perfdata { + my ($self, %options) = @_; + + my $label = 'ifs_used'; + my $value_perf = $self->{result_values}->{used}; + if (defined($instance_mode->{option_results}->{free})) { + $label = 'ifs_free'; + $value_perf = $self->{result_values}->{free}; + } + + my %total_options = (); + if ($instance_mode->{option_results}->{units} eq '%') { + $total_options{total} = $self->{result_values}->{total}; + $total_options{cast_int} = 1; + } + + $self->{output}->perfdata_add(label => $label, unit => 'B', + value => $value_perf, + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, %total_options), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, %total_options), + min => 0, max => $self->{result_values}->{total}); +} + +sub custom_usage_threshold { + my ($self, %options) = @_; + + my ($exit, $threshold_value); + $threshold_value = $self->{result_values}->{used}; + $threshold_value = $self->{result_values}->{free} if (defined($instance_mode->{option_results}->{free})); + if ($instance_mode->{option_results}->{units} eq '%') { + $threshold_value = $self->{result_values}->{prct_used}; + $threshold_value = $self->{result_values}->{prct_free} if (defined($instance_mode->{option_results}->{free})); + } + $exit = $self->{perfdata}->threshold_check(value => $threshold_value, threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, { label => 'warning-'. $self->{label}, exit_litteral => 'warning' } ]); + return $exit; +} + +sub custom_usage_output { + my ($self, %options) = @_; + + my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{total}); + my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{used}); + my ($total_free_value, $total_free_unit) = $self->{perfdata}->change_bytes(value => $self->{result_values}->{free}); + my $msg = sprintf("IFS Usage Total: %s Used: %s (%.2f%%) Free: %s (%.2f%%)", + $total_size_value . " " . $total_size_unit, + $total_used_value . " " . $total_used_unit, $self->{result_values}->{prct_used}, + $total_free_value . " " . $total_free_unit, $self->{result_values}->{prct_free}); + return $msg; +} + +sub custom_usage_calc { + my ($self, %options) = @_; + + $self->{result_values}->{total} = $options{new_datas}->{$self->{instance} . '_total'}; + $self->{result_values}->{used} = $options{new_datas}->{$self->{instance} . '_used'}; + $self->{result_values}->{free} = $self->{result_values}->{total} - $self->{result_values}->{used}; + $self->{result_values}->{prct_used} = $self->{result_values}->{used} * 100 / $self->{result_values}->{total}; + $self->{result_values}->{prct_free} = 100 - $self->{result_values}->{prct_used}; + + return 0; +} + +sub set_counters { + my ($self, %options) = @_; + + $self->{maps_counters_type} = [ + { name => 'cluster', type => 0, cb_prefix_output => 'prefix_cluster_output', message_separator => ' - ' }, + ]; + + $self->{maps_counters}->{cluster} = [ + { label => 'status', threshold => 0, set => { + key_values => [ { name => 'status' } ], + closure_custom_calc => $self->can('custom_status_calc'), + closure_custom_output => $self->can('custom_status_output'), + closure_custom_perfdata => sub { return 0; }, + closure_custom_threshold_check => $self->can('custom_status_threshold'), + } + }, + { label => 'health', set => { + key_values => [ { name => 'health' } ], + output_template => 'Node health: %.2f%%', + perfdatas => [ + { label => 'health', value => 'health_absolute', template => '%2f', + min => 0, max => 100, unit => '%' }, + ], + } + }, + { label => 'ifs-usage', set => { + key_values => [ { name => 'used' }, { name => 'total' } ], + closure_custom_calc => $self->can('custom_usage_calc'), + closure_custom_output => $self->can('custom_usage_output'), + closure_custom_perfdata => $self->can('custom_usage_perfdata'), + closure_custom_threshold_check => $self->can('custom_usage_threshold'), + } + }, + ]; +} + +sub new { + my ($class, %options) = @_; + my $self = $class->SUPER::new(package => __PACKAGE__, %options); + bless $self, $class; + + $self->{version} = '1.0'; + $options{options}->add_options(arguments => + { + "warning-status:s" => { name => 'warning_status', default => '%{status} =~ /attn/' }, + "critical-status:s" => { name => 'critical_status', default => '%{status} =~ /down|invalid/' }, + "units:s" => { name => 'units', default => '%' }, + "free" => { name => 'free' }, + }); + + return $self; +} + +sub check_options { + my ($self, %options) = @_; + $self->SUPER::check_options(%options); + + $instance_mode = $self; + $self->change_macros(); +} + +sub prefix_cluster_output { + my ($self, %options) = @_; + + return "Cluster "; +} + +sub change_macros { + my ($self, %options) = @_; + + foreach (('warning_status', 'critical_status')) { + if (defined($self->{option_results}->{$_})) { + $self->{option_results}->{$_} =~ s/%\{(.*?)\}/\$self->{result_values}->{$1}/g; + } + } +} + +my %mapping_health = ( + 0 => 'ok', + 1 => 'attn', + 2 => 'down', + 3 => 'invalid', +); + +my $mapping = { + clusterHealth => { oid => '.1.3.6.1.4.1.12124.1.1.2', map => \%mapping_health }, + nodeCount => { oid => '.1.3.6.1.4.1.12124.1.1.4' }, + onlineNodes => { oid => '.1.3.6.1.4.1.12124.1.1.6' }, + ifsTotalBytes => { oid => '.1.3.6.1.4.1.12124.1.3.1' }, + ifsUsedBytes => { oid => '.1.3.6.1.4.1.12124.1.3.2' }, + ifsAvailableBytes => { oid => '.1.3.6.1.4.1.12124.1.3.3' }, +}; + +my $oid_clusterStatus = '.1.3.6.1.4.1.12124.1.1'; +my $oid_ifsFilesystem = '.1.3.6.1.4.1.12124.1.3'; + +sub manage_selection { + my ($self, %options) = @_; + + $self->{results} = $options{snmp}->get_multiple_table(oids => [{ oid => $oid_clusterStatus }, + { oid => $oid_ifsFilesystem }, + ], + nothing_quit => 1, return_type => 1); + + my $result = $options{snmp}->map_instance(mapping => $mapping, results => $self->{results}, instance => '0'); + + my @online_nodes = split(/,/, $result->{onlineNodes}); + my $health = scalar(@online_nodes) * 100 / $result->{nodeCount}; + + $self->{cluster} = { + status => $result->{clusterHealth}, + health => $health, + total => $result->{ifsTotalBytes}, + used => $result->{ifsUsedBytes}, + }; +} + +1; + +__END__ + +=head1 MODE + +Check cluster usages. + +=over 8 + +=item B<--filter-counters> + +Only display some counters (regexp can be used). +Example: --filter-counters='^status$' + +=item B<--warning-status> + +Set warning threshold for status (Default: '%{status} =~ /attn/). +Can used special variables like: %{status} + +=item B<--critical-status> + +Set critical threshold for status (Default: '%{status} =~ /down|invalid/'). +Can used special variables like: %{status} + +=item B<--warning-*> + +Threshold warning. +Can be: 'ifs-usage', 'health'. + +=item B<--critical-*> + +Threshold critical. +Can be: 'ifs-usage', 'health'. + +=item B<--units> + +Units of thresholds (Default: '%') ('%', 'B'). + +=item B<--free> + +Thresholds are on free space left. + +=back + +=cut diff --git a/storage/emc/isilon/snmp/mode/components/disk.pm b/storage/emc/isilon/snmp/mode/components/disk.pm new file mode 100644 index 000000000..b6c629822 --- /dev/null +++ b/storage/emc/isilon/snmp/mode/components/disk.pm @@ -0,0 +1,68 @@ +# +# 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::emc::isilon::snmp::mode::components::disk; + +use strict; +use warnings; + +my $mapping = { + diskLogicalNumber => { oid => '.1.3.6.1.4.1.12124.2.52.1.2' }, + diskChassisNumber => { oid => '.1.3.6.1.4.1.12124.2.52.1.3' }, + diskDeviceName => { oid => '.1.3.6.1.4.1.12124.2.52.1.4' }, + diskStatus => { oid => '.1.3.6.1.4.1.12124.2.52.1.5' }, +}; +my $oid_diskEntry = '.1.3.6.1.4.1.12124.2.52.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_diskEntry }; +} + +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_diskEntry}})) { + next if ($oid !~ /^$mapping->{diskStatus}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_diskEntry}, 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] [logical = %s] [chassis = %s]", + $result->{diskDeviceName}, $result->{diskStatus}, $instance, + $result->{diskLogicalNumber}, $result->{diskChassisNumber} + )); + + my $exit = $self->get_severity(section => 'disk', value => $result->{diskStatus}); + 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->{diskDeviceName}, $result->{diskStatus})); + } + } +} + +1; \ No newline at end of file diff --git a/storage/emc/isilon/snmp/mode/components/fan.pm b/storage/emc/isilon/snmp/mode/components/fan.pm new file mode 100644 index 000000000..2b293d086 --- /dev/null +++ b/storage/emc/isilon/snmp/mode/components/fan.pm @@ -0,0 +1,73 @@ +# +# 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::emc::isilon::snmp::mode::components::fan; + +use strict; +use warnings; + +my $mapping = { + fanName => { oid => '.1.3.6.1.4.1.12124.2.53.1.2' }, + fanDescription => { oid => '.1.3.6.1.4.1.12124.2.53.1.3' }, + fanSpeed => { oid => '.1.3.6.1.4.1.12124.2.53.1.4' }, +}; + +my $oid_fanEntry = '.1.3.6.1.4.1.12124.2.53.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_fanEntry }; +} + +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_fanEntry}})) { + next if ($oid !~ /^$mapping->{fanSpeed}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_fanEntry}, instance => $instance); + + next if ($self->check_filter(section => 'fan', instance => $instance)); + $self->{components}->{fan}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("fan '%s' is %s rpm [instance = %s] [description = %s]", + $result->{fanName}, $result->{fanSpeed}, $instance, + $result->{fanDescription})); + + my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, value => $result->{fanSpeed}); + + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Fan '%s' is %s rpm", $result->{fanName}, $result->{fanSpeed})); + } + $self->{output}->perfdata_add(label => 'speed_' . $result->{fanName}, unit => 'rpm', + value => $result->{fanSpeed}, + warning => $warn, + critical => $crit, + ); + } +} + +1; \ No newline at end of file diff --git a/storage/emc/isilon/snmp/mode/components/power.pm b/storage/emc/isilon/snmp/mode/components/power.pm new file mode 100644 index 000000000..31c751f01 --- /dev/null +++ b/storage/emc/isilon/snmp/mode/components/power.pm @@ -0,0 +1,73 @@ +# +# 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::emc::isilon::snmp::mode::components::power; + +use strict; +use warnings; + +my $mapping = { + powerSensorName => { oid => '.1.3.6.1.4.1.12124.2.55.1.2' }, + powerSensorDescription => { oid => '.1.3.6.1.4.1.12124.2.55.1.3' }, + powerSensorValue => { oid => '.1.3.6.1.4.1.12124.2.55.1.4' }, +}; + +my $oid_powerSensorEntry = '.1.3.6.1.4.1.12124.2.55.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_powerSensorEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking power"); + $self->{components}->{power} = {name => 'power', total => 0, skip => 0}; + return if ($self->check_filter(section => 'power')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_powerSensorEntry}})) { + next if ($oid !~ /^$mapping->{powerSensorValue}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_powerSensorEntry}, instance => $instance); + + next if ($self->check_filter(section => 'power', instance => $instance)); + $self->{components}->{power}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("Power '%s' sensor is %s [instance = %s] [description = %s]", + $result->{powerSensorName}, $result->{powerSensorValue}, $instance, + $result->{powerSensorDescription})); + + my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, value => $result->{powerSensorValue}); + + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Power '%s' sensor is %s (Volt or Amp)", $result->{powerSensorName}, $result->{powerSensorValue})); + } + $self->{output}->perfdata_add(label => 'power_' . $result->{powerSensorName}, + value => $result->{powerSensorValue}, + warning => $warn, + critical => $crit, + ); + } +} + +1; \ No newline at end of file diff --git a/storage/emc/isilon/snmp/mode/components/temperature.pm b/storage/emc/isilon/snmp/mode/components/temperature.pm new file mode 100644 index 000000000..150663e14 --- /dev/null +++ b/storage/emc/isilon/snmp/mode/components/temperature.pm @@ -0,0 +1,73 @@ +# +# 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::emc::isilon::snmp::mode::components::temperature; + +use strict; +use warnings; + +my $mapping = { + tempSensorName => { oid => '.1.3.6.1.4.1.12124.2.54.1.2' }, + tempSensorDescription => { oid => '.1.3.6.1.4.1.12124.2.54.1.3' }, + tempSensorValue => { oid => '.1.3.6.1.4.1.12124.2.54.1.4' }, +}; + +my $oid_tempSensorEntry = '.1.3.6.1.4.1.12124.2.54.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_tempSensorEntry }; +} + +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_tempSensorEntry}})) { + next if ($oid !~ /^$mapping->{tempSensorValue}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_tempSensorEntry}, 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 C [instance = %s] [description = %s]", + $result->{tempSensorName}, $result->{tempSensorValue}, $instance, + $result->{tempSensorDescription})); + + my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{tempSensorValue}); + + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Temperature '%s' is %s C", $result->{tempSensorName}, $result->{tempSensorValue})); + } + $self->{output}->perfdata_add(label => 'temperature_' . $result->{tempSensorName}, unit => 'C', + value => $result->{tempSensorValue}, + warning => $warn, + critical => $crit, + ); + } +} + +1; \ No newline at end of file diff --git a/storage/emc/isilon/snmp/mode/hardware.pm b/storage/emc/isilon/snmp/mode/hardware.pm new file mode 100644 index 000000000..c4b6b4afb --- /dev/null +++ b/storage/emc/isilon/snmp/mode/hardware.pm @@ -0,0 +1,113 @@ +# +# 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::emc::isilon::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} = '^(disk)$'; + $self->{regexp_threshold_numeric_check_section_option} = '^(fan|temperature|power)$'; + + $self->{cb_hook1} = 'get_version'; # before the loads + $self->{cb_hook2} = 'snmp_execute'; + + $self->{thresholds} = { + disk => [ + ['healthy', 'OK'], + ['preparing', 'OK'], + ['.*', 'CRITICAL'], + ], + }; + + $self->{components_path} = 'storage::emc::isilon::snmp::mode::components'; + $self->{components_module} = ['fan', 'temperature', 'power', 'disk']; +} + +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 components. + +=over 8 + +=item B<--component> + +Which component to check (Default: '.*'). +Can be: 'fan', 'disk', 'temperature', 'power'. + +=item B<--filter> + +Exclude some parts (comma seperated list) (Example: --filter=fan --filter=power) +Can also exclude specific instance: --filter=power,3.3 + +=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='fan,CRITICAL,^(?!(ok)$)' + +=item B<--warning> + +Set warning threshold (syntax: type,instance,threshold) +Example: --warning='temperature,.*,20' + +=item B<--critical> + +Set critical threshold (syntax: type,instance,threshold) +Example: --critical='temperature,1.1,25' --critical='battery,.*,20:' + +=back + +=cut + diff --git a/storage/emc/isilon/snmp/plugin.pm b/storage/emc/isilon/snmp/plugin.pm new file mode 100644 index 000000000..c560cdb96 --- /dev/null +++ b/storage/emc/isilon/snmp/plugin.pm @@ -0,0 +1,49 @@ +# +# 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::emc::isilon::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}} = ( + 'cluster-usage' => 'storage::emc::isilon::snmp::mode::clusterusage', + 'hardware' => 'storage::emc::isilon::snmp::mode::hardware', + ); + + return $self; +} + +1; + +__END__ + +=head1 PLUGIN DESCRIPTION + +Check EMC Isilon in SNMP. + +=cut