enh(qnap): memory mode - add a --force-counters-legacy (#2880)

as a workaround to memory buggy counters
This commit is contained in:
UrBnW 2021-06-16 13:05:09 +02:00 committed by GitHub
parent c130e895df
commit 429a1174cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 3 deletions

View File

@ -77,7 +77,11 @@ sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
'force-counters-legacy' => { name => 'force_counters_legacy' }
});
return $self;
}
@ -149,8 +153,10 @@ sub manage_selection {
oids => [ map($_->{oid} . '.0', values(%{$mapping->{legacy}}), values(%{$mapping->{ex}}), values(%{$mapping->{es}})) ],
nothing_quit => 1
);
$self->check_memory(snmp => $options{snmp}, type => 'ex', snmp_result => $snmp_result);
$self->check_memory(snmp => $options{snmp}, type => 'es', snmp_result => $snmp_result, convert => 1);
if (!defined($self->{option_results}->{force_counters_legacy})) {
$self->check_memory(snmp => $options{snmp}, type => 'ex', snmp_result => $snmp_result);
$self->check_memory(snmp => $options{snmp}, type => 'es', snmp_result => $snmp_result, convert => 1);
}
$self->check_memory(snmp => $options{snmp}, type => 'legacy', snmp_result => $snmp_result, convert => 1);
}
@ -164,6 +170,10 @@ Check memory.
=over 8
=item B<--force-counters-legacy>
Force to use legacy counters. Should be used when EX/ES counters are buggy.
=item B<--warning-*> B<--critical-*>
Thresholds.