enh(qnap/snmp): mode volumes - add --force-counters-legacy option (#3309)

This commit is contained in:
qgarnier 2021-12-08 14:54:36 +01:00 committed by GitHub
parent c3b419e604
commit 6ab0d8baf2
1 changed files with 17 additions and 9 deletions

View File

@ -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.