From e0acc1b7d27d83c42f9172400bceb3e5907678a4 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Tue, 4 Jun 2019 15:39:54 +0200 Subject: [PATCH] refactoring lmsensors snmp --- apps/lmsensors/mode/fan.pm | 178 ------------------ apps/lmsensors/mode/misc.pm | 178 ------------------ apps/lmsensors/mode/temperature.pm | 178 ------------------ apps/lmsensors/mode/voltage.pm | 178 ------------------ apps/lmsensors/snmp/mode/components/fan.pm | 76 ++++++++ apps/lmsensors/snmp/mode/components/misc.pm | 76 ++++++++ .../snmp/mode/components/temperature.pm | 76 ++++++++ .../lmsensors/snmp/mode/components/voltage.pm | 76 ++++++++ apps/lmsensors/snmp/mode/sensors.pm | 101 ++++++++++ apps/lmsensors/{ => snmp}/plugin.pm | 11 +- storage/emc/DataDomain/mode/filesystem.pm | 30 +-- 11 files changed, 426 insertions(+), 732 deletions(-) delete mode 100644 apps/lmsensors/mode/fan.pm delete mode 100644 apps/lmsensors/mode/misc.pm delete mode 100644 apps/lmsensors/mode/temperature.pm delete mode 100644 apps/lmsensors/mode/voltage.pm create mode 100644 apps/lmsensors/snmp/mode/components/fan.pm create mode 100644 apps/lmsensors/snmp/mode/components/misc.pm create mode 100644 apps/lmsensors/snmp/mode/components/temperature.pm create mode 100644 apps/lmsensors/snmp/mode/components/voltage.pm create mode 100644 apps/lmsensors/snmp/mode/sensors.pm rename apps/lmsensors/{ => snmp}/plugin.pm (76%) diff --git a/apps/lmsensors/mode/fan.pm b/apps/lmsensors/mode/fan.pm deleted file mode 100644 index 69b725562..000000000 --- a/apps/lmsensors/mode/fan.pm +++ /dev/null @@ -1,178 +0,0 @@ -# -# Copyright 2019 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 apps::lmsensors::mode::fan; - -use base qw(centreon::plugins::mode); - -use strict; -use warnings; - -my $oid_SensorDesc = '.1.3.6.1.4.1.2021.13.16.3.1.2'; # fan entry description -my $oid_SensorValue = '.1.3.6.1.4.1.2021.13.16.3.1.3'; # fan entry value (RPM) - -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:s" => { name => 'warning' }, - "critical:s" => { name => 'critical' }, - "name" => { name => 'use_name' }, - "sensor:s" => { name => 'sensor' }, - "regexp" => { name => 'use_regexp' }, - "regexp-isensitive" => { name => 'use_regexpi' }, - }); - - $self->{Sensor_id_selected} = []; - - return $self; -} - -sub check_options { - my ($self, %options) = @_; - $self->SUPER::init(%options); - - if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'."); - $self->{output}->option_exit(); - } - if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'."); - $self->{output}->option_exit(); - } - -} - -sub run { - my ($self, %options) = @_; - $self->{snmp} = $options{snmp}; - $self->{hostname} = $self->{snmp}->get_hostname(); - $self->{snmp_port} = $self->{snmp}->get_port(); - - $self->manage_selection(); - - $self->{snmp}->load(oids => [$oid_SensorDesc, $oid_SensorValue], instances => $self->{Sensor_id_selected}); - my $SensorValueResult = $self->{snmp}->get_leef(nothing_quit => 1); - - if (!defined($self->{option_results}->{sensor}) || defined($self->{option_results}->{use_regexp})) { - $self->{output}->output_add(severity => 'OK', - short_msg => 'All Fans are ok.'); - } - - foreach my $SensorId (sort @{$self->{Sensor_id_selected}}) { - my $SensorDesc = $SensorValueResult->{$oid_SensorDesc . '.' . $SensorId}; - my $SensorValue = $SensorValueResult->{$oid_SensorValue . '.' . $SensorId}; - - my $exit = $self->{perfdata}->threshold_check(value => $SensorValue, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); - - $self->{output}->output_add(long_msg => sprintf("Sensor '%s' Fan: %s", - $SensorDesc, $SensorValue)); - if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1) || (defined($self->{option_results}->{sensor}) && !defined($self->{option_results}->{use_regexp}))) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Sensor '%s' Fan: %s", - $SensorDesc, $SensorValue)); - } - - my $label = 'sensor_fan'; - my $extra_label = ''; - $extra_label = '_' . $SensorId . "_" . $SensorDesc if (!defined($self->{option_results}->{sensor}) || defined($self->{option_results}->{use_regexp})); - $self->{output}->perfdata_add(label => $label . $extra_label, - value => $SensorValue, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical')); - } - - $self->{output}->display(); - $self->{output}->exit(); -} - -sub manage_selection { - my ($self, %options) = @_; - my $result = $self->{snmp}->get_table(oid => $oid_SensorDesc, nothing_quit => 1); - - foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) { - next if ($key !~ /\.([0-9]+)$/); - my $SensorId = $1; - my $SensorDesc = $result->{$key}; - - next if (defined($self->{option_results}->{sensor}) && !defined($self->{option_results}->{use_name}) && !defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi}) - && $SensorId !~ /$self->{option_results}->{sensor}/i); - next if (defined($self->{option_results}->{use_name}) && defined($self->{option_results}->{use_regexp}) && defined($self->{option_results}->{use_regexpi}) - && $SensorDesc !~ /$self->{option_results}->{sensor}/i); - next if (defined($self->{option_results}->{use_name}) && defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi}) - && $SensorDesc !~ /$self->{option_results}->{sensor}/); - next if (defined($self->{option_results}->{use_name}) && !defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi}) - && $SensorDesc ne $self->{option_results}->{sensor}); - - - push @{$self->{Sensor_id_selected}}, $SensorId; -} - - if (scalar(@{$self->{Sensor_id_selected}}) <= 0) { - if (defined($self->{option_results}->{sensor})) { - $self->{output}->add_option_msg(short_msg => "No Sensors found for '" . $self->{option_results}->{sensor} . "'."); - } else { - $self->{output}->add_option_msg(short_msg => "No Sensors found."); - }; - $self->{output}->option_exit(); - } -} - -1; - -__END__ - -=head1 MODE - -Check LM-Sensors: Fan Sensors - -=over 8 - -=item B<--warning> - -Threshold warning (Fan Speed, U/min) - -=item B<--critical> - -Threshold critical (Fan Speed, U/min) - -=item B<--sensor> - -Set the Sensor Desc (number expected) ex: 1, 2,... (empty means 'check all sensors'). - -=item B<--name> - -Allows to use Sensor Desc name with option --sensor instead of Sensor Desc oid index. - -=item B<--regexp> - -Allows to use regexp to filter sensordesc (with option --name). - -=item B<--regexp-isensitive> - -Allows to use regexp non case-sensitive (with --regexp). - -=back - -=cut diff --git a/apps/lmsensors/mode/misc.pm b/apps/lmsensors/mode/misc.pm deleted file mode 100644 index 512fcd4c0..000000000 --- a/apps/lmsensors/mode/misc.pm +++ /dev/null @@ -1,178 +0,0 @@ -# -# Copyright 2019 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 apps::lmsensors::mode::misc; - -use base qw(centreon::plugins::mode); - -use strict; -use warnings; - -my $oid_SensorDesc = '.1.3.6.1.4.1.2021.13.16.5.1.2'; # misc entry description -my $oid_SensorValue = '.1.3.6.1.4.1.2021.13.16.5.1.3'; # misc entry value - -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:s" => { name => 'warning' }, - "critical:s" => { name => 'critical' }, - "name" => { name => 'use_name' }, - "sensor:s" => { name => 'sensor' }, - "regexp" => { name => 'use_regexp' }, - "regexp-isensitive" => { name => 'use_regexpi' }, - }); - - $self->{Sensor_id_selected} = []; - - return $self; -} - -sub check_options { - my ($self, %options) = @_; - $self->SUPER::init(%options); - - if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'."); - $self->{output}->option_exit(); - } - if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'."); - $self->{output}->option_exit(); - } - -} - -sub run { - my ($self, %options) = @_; - $self->{snmp} = $options{snmp}; - $self->{hostname} = $self->{snmp}->get_hostname(); - $self->{snmp_port} = $self->{snmp}->get_port(); - - $self->manage_selection(); - - $self->{snmp}->load(oids => [$oid_SensorDesc, $oid_SensorValue], instances => $self->{Sensor_id_selected}); - my $SensorValueResult = $self->{snmp}->get_leef(nothing_quit => 1); - - if (!defined($self->{option_results}->{sensor}) || defined($self->{option_results}->{use_regexp})) { - $self->{output}->output_add(severity => 'OK', - short_msg => 'All Sensors are ok.'); - } - - foreach my $SensorId (sort @{$self->{Sensor_id_selected}}) { - my $SensorDesc = $SensorValueResult->{$oid_SensorDesc . '.' . $SensorId}; - my $SensorValue = $SensorValueResult->{$oid_SensorValue . '.' . $SensorId} / 1000; - - my $exit = $self->{perfdata}->threshold_check(value => $SensorValue, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); - - $self->{output}->output_add(long_msg => sprintf("Sensor '%s': %s", - $SensorDesc, $SensorValue)); - if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1) || (defined($self->{option_results}->{sensor}) && !defined($self->{option_results}->{use_regexp}))) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Sensor '%s': %s", - $SensorDesc, $SensorValue)); - } - - my $label = 'sensor_misc'; - my $extra_label = ''; - $extra_label = '_' . $SensorId . "_" . $SensorDesc if (!defined($self->{option_results}->{sensor}) || defined($self->{option_results}->{use_regexp})); - $self->{output}->perfdata_add(label => $label . $extra_label, - value => $SensorValue, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical')); - } - - $self->{output}->display(); - $self->{output}->exit(); -} - -sub manage_selection { - my ($self, %options) = @_; - my $result = $self->{snmp}->get_table(oid => $oid_SensorDesc, nothing_quit => 1); - - foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) { - next if ($key !~ /\.([0-9]+)$/); - my $SensorId = $1; - my $SensorDesc = $result->{$key}; - - next if (defined($self->{option_results}->{sensor}) && !defined($self->{option_results}->{use_name}) && !defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi}) - && $SensorId !~ /$self->{option_results}->{sensor}/i); - next if (defined($self->{option_results}->{use_name}) && defined($self->{option_results}->{use_regexp}) && defined($self->{option_results}->{use_regexpi}) - && $SensorDesc !~ /$self->{option_results}->{sensor}/i); - next if (defined($self->{option_results}->{use_name}) && defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi}) - && $SensorDesc !~ /$self->{option_results}->{sensor}/); - next if (defined($self->{option_results}->{use_name}) && !defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi}) - && $SensorDesc ne $self->{option_results}->{sensor}); - - - push @{$self->{Sensor_id_selected}}, $SensorId; -} - - if (scalar(@{$self->{Sensor_id_selected}}) <= 0) { - if (defined($self->{option_results}->{sensor})) { - $self->{output}->add_option_msg(short_msg => "No Sensors found for '" . $self->{option_results}->{sensor} . "'."); - } else { - $self->{output}->add_option_msg(short_msg => "No Sensors found."); - }; - $self->{output}->option_exit(); - } -} - -1; - -__END__ - -=head1 MODE - -Check LM-Sensors: Misc Sensors - -=over 8 - -=item B<--warning> - -Threshold warning - -=item B<--critical> - -Threshold critical - -=item B<--sensor> - -Set the Sensor Desc (number expected) ex: 1, 2,... (empty means 'check all sensors'). - -=item B<--name> - -Allows to use Sensor Desc name with option --sensor instead of Sensor Desc oid index. - -=item B<--regexp> - -Allows to use regexp to filter sensordesc (with option --name). - -=item B<--regexp-isensitive> - -Allows to use regexp non case-sensitive (with --regexp). - -=back - -=cut diff --git a/apps/lmsensors/mode/temperature.pm b/apps/lmsensors/mode/temperature.pm deleted file mode 100644 index 3b0abc72c..000000000 --- a/apps/lmsensors/mode/temperature.pm +++ /dev/null @@ -1,178 +0,0 @@ -# -# Copyright 2019 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 apps::lmsensors::mode::temperature; - -use base qw(centreon::plugins::mode); - -use strict; -use warnings; - -my $oid_SensorDesc = '.1.3.6.1.4.1.2021.13.16.2.1.2'; # temperature entry description -my $oid_SensorValue = '.1.3.6.1.4.1.2021.13.16.2.1.3'; # temperature entry value (RPM) - -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:s" => { name => 'warning' }, - "critical:s" => { name => 'critical' }, - "name" => { name => 'use_name' }, - "sensor:s" => { name => 'sensor' }, - "regexp" => { name => 'use_regexp' }, - "regexp-isensitive" => { name => 'use_regexpi' }, - }); - - $self->{Sensor_id_selected} = []; - - return $self; -} - -sub check_options { - my ($self, %options) = @_; - $self->SUPER::init(%options); - - if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'."); - $self->{output}->option_exit(); - } - if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'."); - $self->{output}->option_exit(); - } - -} - -sub run { - my ($self, %options) = @_; - $self->{snmp} = $options{snmp}; - $self->{hostname} = $self->{snmp}->get_hostname(); - $self->{snmp_port} = $self->{snmp}->get_port(); - - $self->manage_selection(); - - $self->{snmp}->load(oids => [$oid_SensorDesc, $oid_SensorValue], instances => $self->{Sensor_id_selected}); - my $SensorValueResult = $self->{snmp}->get_leef(nothing_quit => 1); - - if (!defined($self->{option_results}->{sensor}) || defined($self->{option_results}->{use_regexp})) { - $self->{output}->output_add(severity => 'OK', - short_msg => 'All Temperatures are ok.'); - } - - foreach my $SensorId (sort @{$self->{Sensor_id_selected}}) { - my $SensorDesc = $SensorValueResult->{$oid_SensorDesc . '.' . $SensorId}; - my $SensorValue = $SensorValueResult->{$oid_SensorValue . '.' . $SensorId} / 1000; - - my $exit = $self->{perfdata}->threshold_check(value => $SensorValue, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); - - $self->{output}->output_add(long_msg => sprintf("Sensor '%s' Temperature: %s", - $SensorDesc, $SensorValue)); - if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1) || (defined($self->{option_results}->{sensor}) && !defined($self->{option_results}->{use_regexp}))) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Sensor '%s' Temperature: %s", - $SensorDesc, $SensorValue)); - } - - my $label = 'sensor_temperature'; - my $extra_label = ''; - $extra_label = '_' . $SensorId . "_" . $SensorDesc if (!defined($self->{option_results}->{sensor}) || defined($self->{option_results}->{use_regexp})); - $self->{output}->perfdata_add(label => $label . $extra_label, - value => $SensorValue, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical')); - } - - $self->{output}->display(); - $self->{output}->exit(); -} - -sub manage_selection { - my ($self, %options) = @_; - my $result = $self->{snmp}->get_table(oid => $oid_SensorDesc, nothing_quit => 1); - - foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) { - next if ($key !~ /\.([0-9]+)$/); - my $SensorId = $1; - my $SensorDesc = $result->{$key}; - - next if (defined($self->{option_results}->{sensor}) && !defined($self->{option_results}->{use_name}) && !defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi}) - && $SensorId !~ /$self->{option_results}->{sensor}/i); - next if (defined($self->{option_results}->{use_name}) && defined($self->{option_results}->{use_regexp}) && defined($self->{option_results}->{use_regexpi}) - && $SensorDesc !~ /$self->{option_results}->{sensor}/i); - next if (defined($self->{option_results}->{use_name}) && defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi}) - && $SensorDesc !~ /$self->{option_results}->{sensor}/); - next if (defined($self->{option_results}->{use_name}) && !defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi}) - && $SensorDesc ne $self->{option_results}->{sensor}); - - - push @{$self->{Sensor_id_selected}}, $SensorId; -} - - if (scalar(@{$self->{Sensor_id_selected}}) <= 0) { - if (defined($self->{option_results}->{sensor})) { - $self->{output}->add_option_msg(short_msg => "No Sensors found for '" . $self->{option_results}->{sensor} . "'."); - } else { - $self->{output}->add_option_msg(short_msg => "No Sensors found."); - }; - $self->{output}->option_exit(); - } -} - -1; - -__END__ - -=head1 MODE - -Check LM-Sensors: Temperature Sensors - -=over 8 - -=item B<--warning> - -Threshold warning - -=item B<--critical> - -Threshold critical - -=item B<--sensor> - -Set the Sensor Desc (number expected) ex: 1, 2,... (empty means 'check all sensors'). - -=item B<--name> - -Allows to use Sensor Desc name with option --sensor instead of Sensor Desc oid index. - -=item B<--regexp> - -Allows to use regexp to filter sensordesc (with option --name). - -=item B<--regexp-isensitive> - -Allows to use regexp non case-sensitive (with --regexp). - -=back - -=cut diff --git a/apps/lmsensors/mode/voltage.pm b/apps/lmsensors/mode/voltage.pm deleted file mode 100644 index 9c742f696..000000000 --- a/apps/lmsensors/mode/voltage.pm +++ /dev/null @@ -1,178 +0,0 @@ -# -# Copyright 2019 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 apps::lmsensors::mode::voltage; - -use base qw(centreon::plugins::mode); - -use strict; -use warnings; - -my $oid_SensorDesc = '.1.3.6.1.4.1.2021.13.16.4.1.2'; # voltage entry description -my $oid_SensorValue = '.1.3.6.1.4.1.2021.13.16.4.1.3'; # voltage entry value (mV) - -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:s" => { name => 'warning' }, - "critical:s" => { name => 'critical' }, - "name" => { name => 'use_name' }, - "sensor:s" => { name => 'sensor' }, - "regexp" => { name => 'use_regexp' }, - "regexp-isensitive" => { name => 'use_regexpi' }, - }); - - $self->{Sensor_id_selected} = []; - - return $self; -} - -sub check_options { - my ($self, %options) = @_; - $self->SUPER::init(%options); - - if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'."); - $self->{output}->option_exit(); - } - if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) { - $self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'."); - $self->{output}->option_exit(); - } - -} - -sub run { - my ($self, %options) = @_; - $self->{snmp} = $options{snmp}; - $self->{hostname} = $self->{snmp}->get_hostname(); - $self->{snmp_port} = $self->{snmp}->get_port(); - - $self->manage_selection(); - - $self->{snmp}->load(oids => [$oid_SensorDesc, $oid_SensorValue], instances => $self->{Sensor_id_selected}); - my $SensorValueResult = $self->{snmp}->get_leef(nothing_quit => 1); - - if (!defined($self->{option_results}->{sensor}) || defined($self->{option_results}->{use_regexp})) { - $self->{output}->output_add(severity => 'OK', - short_msg => 'All Voltages are ok.'); - } - - foreach my $SensorId (sort @{$self->{Sensor_id_selected}}) { - my $SensorDesc = $SensorValueResult->{$oid_SensorDesc . '.' . $SensorId}; - my $SensorValue = $SensorValueResult->{$oid_SensorValue . '.' . $SensorId} / 1000; - - my $exit = $self->{perfdata}->threshold_check(value => $SensorValue, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); - - $self->{output}->output_add(long_msg => sprintf("Sensor '%s' Volt: %s", - $SensorDesc, $SensorValue)); - if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1) || (defined($self->{option_results}->{sensor}) && !defined($self->{option_results}->{use_regexp}))) { - $self->{output}->output_add(severity => $exit, - short_msg => sprintf("Sensor '%s' Volt: %s", - $SensorDesc, $SensorValue)); - } - - my $label = 'sensor_voltage'; - my $extra_label = ''; - $extra_label = '_' . $SensorId . "_" . $SensorDesc if (!defined($self->{option_results}->{sensor}) || defined($self->{option_results}->{use_regexp})); - $self->{output}->perfdata_add(label => $label . $extra_label, unit => 'V', - value => $SensorValue, - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical')); - } - - $self->{output}->display(); - $self->{output}->exit(); -} - -sub manage_selection { - my ($self, %options) = @_; - my $result = $self->{snmp}->get_table(oid => $oid_SensorDesc, nothing_quit => 1); - - foreach my $key ($self->{snmp}->oid_lex_sort(keys %$result)) { - next if ($key !~ /\.([0-9]+)$/); - my $SensorId = $1; - my $SensorDesc = $result->{$key}; - - next if (defined($self->{option_results}->{sensor}) && !defined($self->{option_results}->{use_name}) && !defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi}) - && $SensorId !~ /$self->{option_results}->{sensor}/i); - next if (defined($self->{option_results}->{use_name}) && defined($self->{option_results}->{use_regexp}) && defined($self->{option_results}->{use_regexpi}) - && $SensorDesc !~ /$self->{option_results}->{sensor}/i); - next if (defined($self->{option_results}->{use_name}) && defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi}) - && $SensorDesc !~ /$self->{option_results}->{sensor}/); - next if (defined($self->{option_results}->{use_name}) && !defined($self->{option_results}->{use_regexp}) && !defined($self->{option_results}->{use_regexpi}) - && $SensorDesc ne $self->{option_results}->{sensor}); - - - push @{$self->{Sensor_id_selected}}, $SensorId; -} - - if (scalar(@{$self->{Sensor_id_selected}}) <= 0) { - if (defined($self->{option_results}->{sensor})) { - $self->{output}->add_option_msg(short_msg => "No Sensors found for '" . $self->{option_results}->{sensor} . "'."); - } else { - $self->{output}->add_option_msg(short_msg => "No Sensors found."); - }; - $self->{output}->option_exit(); - } -} - -1; - -__END__ - -=head1 MODE - -Check LM-Sensors: Voltage Sensors - -=over 8 - -=item B<--warning> - -Threshold warning (Volt) - -=item B<--critical> - -Threshold critical (Volt) - -=item B<--sensor> - -Set the Sensor Desc (number expected) ex: 1, 2,... (empty means 'check all sensors'). - -=item B<--name> - -Allows to use Sensor Desc name with option --sensor instead of Sensor Desc oid index. - -=item B<--regexp> - -Allows to use regexp to filter sensordesc (with option --name). - -=item B<--regexp-isensitive> - -Allows to use regexp non case-sensitive (with --regexp). - -=back - -=cut diff --git a/apps/lmsensors/snmp/mode/components/fan.pm b/apps/lmsensors/snmp/mode/components/fan.pm new file mode 100644 index 000000000..e2de1751d --- /dev/null +++ b/apps/lmsensors/snmp/mode/components/fan.pm @@ -0,0 +1,76 @@ +# +# Copyright 2019 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 apps::lmsensors::snmp::mode::components::fan; + +use strict; +use warnings; + +my $mapping = { + lmFanSensorsDevice => { oid => '.1.3.6.1.4.1.2021.13.16.3.1.2' }, + lmFanSensorsValue => { oid => '.1.3.6.1.4.1.2021.13.16.3.1.3' }, +}; + +my $oid_lmFanSensorsEntry = '.1.3.6.1.4.1.2021.13.16.3.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_lmFanSensorsEntry }; +} + +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_lmFanSensorsEntry}})) { + next if ($oid !~ /^$mapping->{lmFanSensorsValue}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_lmFanSensorsEntry}, instance => $instance); + + next if ($self->check_filter(section => 'fan', instance => $instance, name => $result->{lmFanSensorsDevice})); + $self->{components}->{fan}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("fan '%s' speed is %s rpm [instance = %s]", + $result->{lmFanSensorsDevice}, $result->{lmFanSensorsValue}, $instance, + )); + + my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'fan', instance => $instance, name => $result->{lmFanSensorsDevice}, value => $result->{lmFanSensorsValue}); + + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Fan '%s' speed is %s rpm", $result->{lmFanSensorsDevice}, $result->{lmFanSensorsValue})); + } + $self->{output}->perfdata_add( + label => 'fan', unit => 'rpm', + nlabel => 'sensor.fan.speed.rpm', + instances => $result->{lmFanSensorsDevice}, + value => $result->{lmFanSensorsValue}, + warning => $warn, + critical => $crit, + min => 0, + ); + } +} + +1; diff --git a/apps/lmsensors/snmp/mode/components/misc.pm b/apps/lmsensors/snmp/mode/components/misc.pm new file mode 100644 index 000000000..0cf93d5b3 --- /dev/null +++ b/apps/lmsensors/snmp/mode/components/misc.pm @@ -0,0 +1,76 @@ +# +# Copyright 2019 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 apps::lmsensors::snmp::mode::components::misc; + +use strict; +use warnings; + +my $mapping = { + lmMiscSensorsDevice => { oid => '.1.3.6.1.4.1.2021.13.16.5.1.2' }, + lmMiscSensorsValue => { oid => '.1.3.6.1.4.1.2021.13.16.5.1.3' }, +}; + +my $oid_lmMiscSensorsEntry = '.1.3.6.1.4.1.2021.13.16.5.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_lmMiscSensorsEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking misc"); + $self->{components}->{misc} = {name => 'misc', total => 0, skip => 0}; + return if ($self->check_filter(section => 'misc')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_lmMiscSensorsEntry}})) { + next if ($oid !~ /^$mapping->{lmMiscSensorsValue}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_lmMiscSensorsEntry}, instance => $instance); + + next if ($self->check_filter(section => 'misc', instance => $instance, name => $result->{lmMiscSensorsDevice})); + $self->{components}->{misc}->{total}++; + + $self->{output}->output_add(long_msg => sprintf("misc '%s' values is %s [instance = %s]", + $result->{lmMiscSensorsDevice}, $result->{lmMiscSensorsValue}, $instance, + )); + + my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'misc', instance => $instance, name => $result->{lmMiscSensorsDevice}, value => $result->{lmMiscSensorsValue}); + + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Misc '%s' value is %s", $result->{lmMiscSensorsDevice}, $result->{lmMiscSensorsValue})); + } + $self->{output}->perfdata_add( + label => 'misc',, + nlabel => 'sensor.misc.current', + instances => $result->{lmMiscSensorsDevice}, + value => $result->{lmMiscSensorsValue}, + warning => $warn, + critical => $crit, + min => 0, + ); + } +} + +1; diff --git a/apps/lmsensors/snmp/mode/components/temperature.pm b/apps/lmsensors/snmp/mode/components/temperature.pm new file mode 100644 index 000000000..b80a3aedc --- /dev/null +++ b/apps/lmsensors/snmp/mode/components/temperature.pm @@ -0,0 +1,76 @@ +# +# Copyright 2019 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 apps::lmsensors::snmp::mode::components::temperature; + +use strict; +use warnings; + +my $mapping = { + lmTempSensorsDevice => { oid => '.1.3.6.1.4.1.2021.13.16.2.1.2' }, + lmTempSensorsValue => { oid => '.1.3.6.1.4.1.2021.13.16.2.1.3' }, +}; + +my $oid_lmTempSensorsEntry = '.1.3.6.1.4.1.2021.13.16.2.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_lmTempSensorsEntry }; +} + +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_lmTempSensorsEntry}})) { + next if ($oid !~ /^$mapping->{lmTempSensorsValue}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_lmTempSensorsEntry}, instance => $instance); + + next if ($self->check_filter(section => 'temperature', instance => $instance, name => $result->{lmTempSensorsDevice})); + $self->{components}->{temperature}->{total}++; + + $result->{lmTempSensorsValue} /= 1000; + $self->{output}->output_add(long_msg => sprintf("temperature '%s' is %s C [instance = %s]", + $result->{lmTempSensorsDevice}, $result->{lmTempSensorsValue}, $instance, + )); + + my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, name => $result->{lmTempSensorsDevice}, value => $result->{lmTempSensorsValue}); + + 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->{lmTempSensorsDevice}, $result->{lmTempSensorsValue})); + } + $self->{output}->perfdata_add( + label => 'temperature', unit => 'C', + nlabel => 'sensor.temperature.celsius', + instances => $result->{lmTempSensorsDevice}, + value => $result->{lmTempSensorsValue}, + warning => $warn, + critical => $crit, + ); + } +} + +1; diff --git a/apps/lmsensors/snmp/mode/components/voltage.pm b/apps/lmsensors/snmp/mode/components/voltage.pm new file mode 100644 index 000000000..c3a9a4412 --- /dev/null +++ b/apps/lmsensors/snmp/mode/components/voltage.pm @@ -0,0 +1,76 @@ +# +# Copyright 2019 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 apps::lmsensors::snmp::mode::components::voltage; + +use strict; +use warnings; + +my $mapping = { + lmVoltSensorsDevice => { oid => '.1.3.6.1.4.1.2021.13.16.4.1.2' }, + lmVoltSensorsValue => { oid => '.1.3.6.1.4.1.2021.13.16.4.1.3' }, +}; + +my $oid_lmVoltSensorsEntry = '.1.3.6.1.4.1.2021.13.16.4.1'; + +sub load { + my ($self) = @_; + + push @{$self->{request}}, { oid => $oid_lmVoltSensorsEntry }; +} + +sub check { + my ($self) = @_; + + $self->{output}->output_add(long_msg => "Checking voltages"); + $self->{components}->{voltage} = {name => 'voltages', total => 0, skip => 0}; + return if ($self->check_filter(section => 'voltage')); + + foreach my $oid ($self->{snmp}->oid_lex_sort(keys %{$self->{results}->{$oid_lmVoltSensorsEntry}})) { + next if ($oid !~ /^$mapping->{lmVoltSensorsValue}->{oid}\.(.*)$/); + my $instance = $1; + my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_lmVoltSensorsEntry}, instance => $instance); + + next if ($self->check_filter(section => 'voltage', instance => $instance, name => $result->{lmVoltSensorsDevice})); + $self->{components}->{voltage}->{total}++; + + $result->{lmVoltSensorsValue} /= 1000; + $self->{output}->output_add(long_msg => sprintf("voltage '%s' is %s V [instance = %s]", + $result->{lmVoltSensorsDevice}, $result->{lmVoltSensorsValue}, $instance, + )); + + my ($exit, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'voltage', instance => $instance, name => $result->{lmVoltSensorsDevice}, value => $result->{lmVoltSensorsValue}); + + if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) { + $self->{output}->output_add(severity => $exit, + short_msg => sprintf("Voltage '%s' is %s V", $result->{lmVoltSensorsDevice}, $result->{lmVoltSensorsValue})); + } + $self->{output}->perfdata_add( + label => 'voltage', unit => 'V', + nlabel => 'sensor.voltage.volt', + instances => $result->{lmVoltSensorsDevice}, + value => $result->{lmVoltSensorsValue}, + warning => $warn, + critical => $crit, + ); + } +} + +1; diff --git a/apps/lmsensors/snmp/mode/sensors.pm b/apps/lmsensors/snmp/mode/sensors.pm new file mode 100644 index 000000000..c796274ea --- /dev/null +++ b/apps/lmsensors/snmp/mode/sensors.pm @@ -0,0 +1,101 @@ +# +# Copyright 2019 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 apps::lmsensors::snmp::mode::sensors; + +use base qw(centreon::plugins::templates::hardware); + +use strict; +use warnings; + +sub set_system { + my ($self, %options) = @_; + + $self->{regexp_threshold_overload_check_section_option} = '^(temperature|fan|voltage|misc)$'; + $self->{regexp_threshold_numeric_check_section_option} = '^(temperature|fan|voltage|misc)$'; + + $self->{cb_hook1} = 'get_version'; # before the loads + $self->{cb_hook2} = 'snmp_execute'; + + $self->{thresholds} = { + }; + + $self->{components_path} = 'apps::lmsensors::snmp::mode::components'; + $self->{components_module} = ['fan', 'temperature', 'voltage', 'misc']; +} + +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, force_new_perfdata => 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', 'voltage', 'temperature', 'misc'. + +=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<--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,25' + +=back + +=cut + diff --git a/apps/lmsensors/plugin.pm b/apps/lmsensors/snmp/plugin.pm similarity index 76% rename from apps/lmsensors/plugin.pm rename to apps/lmsensors/snmp/plugin.pm index de4ca347c..fbb30a929 100644 --- a/apps/lmsensors/plugin.pm +++ b/apps/lmsensors/snmp/plugin.pm @@ -18,7 +18,7 @@ # limitations under the License. # -package apps::lmsensors::plugin; +package apps::lmsensors::snmp::plugin; use strict; use warnings; @@ -31,11 +31,8 @@ sub new { $self->{version} = '0.1'; %{$self->{modes}} = ( - 'temperature' => 'apps::lmsensors::mode::temperature', - 'fan' => 'apps::lmsensors::mode::fan', - 'voltage' => 'apps::lmsensors::mode::voltage', - 'misc' => 'apps::lmsensors::mode::misc', - ); + 'sensors' => 'apps::lmsensors::snmp::mode::sensors', + ); return $self; } @@ -46,6 +43,6 @@ __END__ =head1 PLUGIN DESCRIPTION -Check with SNMP LM-Sensors Status +Check with SNMP LM-Sensors =cut diff --git a/storage/emc/DataDomain/mode/filesystem.pm b/storage/emc/DataDomain/mode/filesystem.pm index d57d17bcf..c0d7eb9d6 100644 --- a/storage/emc/DataDomain/mode/filesystem.pm +++ b/storage/emc/DataDomain/mode/filesystem.pm @@ -87,10 +87,10 @@ sub new { $self->{version} = '1.0'; $options{options}->add_options(arguments => { - "name" => { name => 'use_name' }, - "filesystem:s" => { name => 'filesystem' }, - "regexp" => { name => 'use_regexp' }, - "regexp-isensitive" => { name => 'use_regexpi' }, + 'name' => { name => 'use_name' }, + 'filesystem:s' => { name => 'filesystem' }, + 'regexp' => { name => 'use_regexp' }, + 'regexp-isensitive' => { name => 'use_regexpi' }, }); return $self; @@ -112,11 +112,13 @@ sub add_result { sub manage_selection { my ($self, %options) = @_; - $self->{results} = $options{snmp}->get_multiple_table(oids => [ - { oid => $oid_sysDescr }, - { oid => $oid_fileSystemSpaceEntry }, - ], - nothing_quit => 1); + $self->{results} = $options{snmp}->get_multiple_table( + oids => [ + { oid => $oid_sysDescr }, + { oid => $oid_fileSystemSpaceEntry }, + ], + nothing_quit => 1 + ); if (!($self->{os_version} = storage::emc::DataDomain::lib::functions::get_version(value => $self->{results}->{$oid_sysDescr}->{$oid_sysDescr . '.0'}))) { $self->{output}->output_add(severity => 'UNKNOWN', short_msg => 'Cannot get DataDomain OS version.'); @@ -164,10 +166,10 @@ sub manage_selection { if (defined($self->{option_results}->{device})) { $self->{output}->add_option_msg(short_msg => "No filesystem found '" . $self->{option_results}->{filesystem} . "'."); } else { - $self->{output}->add_option_msg(short_msg => "No filesystem found."); + $self->{output}->add_option_msg(short_msg => 'No filesystem found.'); } $self->{output}->option_exit(); - } + } } sub disco_format { @@ -182,8 +184,10 @@ sub disco_show { $self->{snmp} = $options{snmp}; $self->manage_selection(disco => 1); foreach (sort keys %{$self->{fs}}) { - $self->{output}->add_disco_entry(name => $self->{fs}->{$_}->{display}, - deviceid => $_); + $self->{output}->add_disco_entry( + name => $self->{fs}->{$_}->{display}, + deviceid => $_ + ); } }