From 6ab0d8baf25beb53a0eb51d1ce9ed92afa6dc415 Mon Sep 17 00:00:00 2001 From: qgarnier Date: Wed, 8 Dec 2021 14:54:36 +0100 Subject: [PATCH] enh(qnap/snmp): mode volumes - add --force-counters-legacy option (#3309) --- .../storage/qnap/snmp/mode/volumes.pm | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/centreon-plugins/storage/qnap/snmp/mode/volumes.pm b/centreon-plugins/storage/qnap/snmp/mode/volumes.pm index 67a4bf0c9..b2de9efec 100644 --- a/centreon-plugins/storage/qnap/snmp/mode/volumes.pm +++ b/centreon-plugins/storage/qnap/snmp/mode/volumes.pm @@ -131,7 +131,8 @@ sub new { bless $self, $class; $options{options}->add_options(arguments => { - 'filter-name:s' => { name => 'filter_name' } + 'filter-name:s' => { name => 'filter_name' }, + 'force-counters-legacy' => { name => 'force_counters_legacy' } }); return $self; @@ -228,15 +229,18 @@ sub manage_selection { $self->{volumes} = {}; - my $snmp_result = $options{snmp}->get_table( - oid => '.1.3.6.1.4.1.55062.1.10.9' # volumeTable - ); - return if ($self->check_volumes(snmp => $options{snmp}, type => 'qts', snmp_result => $snmp_result)); + my $snmp_result; + if (!defined($self->{option_results}->{force_counters_legacy})) { + $snmp_result = $options{snmp}->get_table( + oid => '.1.3.6.1.4.1.55062.1.10.9' # volumeTable + ); + return if ($self->check_volumes(snmp => $options{snmp}, type => 'qts', snmp_result => $snmp_result)); - $snmp_result = $options{snmp}->get_table( - oid => '.1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2' # volumeTable - ); - return if ($self->check_volumes(snmp => $options{snmp}, type => 'ex', snmp_result => $snmp_result)); + $snmp_result = $options{snmp}->get_table( + oid => '.1.3.6.1.4.1.24681.1.4.1.1.1.2.3.2' # volumeTable + ); + return if ($self->check_volumes(snmp => $options{snmp}, type => 'ex', snmp_result => $snmp_result)); + } $snmp_result = $options{snmp}->get_table( oid => '.1.3.6.1.4.1.24681.1.2.17', # systemVolumeTable @@ -259,6 +263,10 @@ Check volumes. Filter volumes by name (can be a regexp). +=item B<--force-counters-legacy> + +Force to use legacy counters. Should be used when EX/QTS counters are buggy. + =item B<--unknown-volume-status> Set unknown threshold for status.