From aaa667e087c884d6a4818e158e3f7da957787fce Mon Sep 17 00:00:00 2001 From: qgarnier Date: Wed, 7 Jun 2023 10:04:05 +0200 Subject: [PATCH] =?UTF-8?q?(plugin)=20apps::wallix::bastion::snmp=20-=20mo?= =?UTF-8?q?de=20license=20add=20--filter-cate=E2=80=A6=20(#4447)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apps/wallix/bastion/snmp/mode/license.pm | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/apps/wallix/bastion/snmp/mode/license.pm b/src/apps/wallix/bastion/snmp/mode/license.pm index d483251fe..4b370259e 100644 --- a/src/apps/wallix/bastion/snmp/mode/license.pm +++ b/src/apps/wallix/bastion/snmp/mode/license.pm @@ -191,7 +191,8 @@ sub new { bless $self, $class; $options{options}->add_options(arguments => { - 'unit:s' => { name => 'unit', default => 's' } + 'filter-category:s' => { name => 'filter_category' }, + 'unit:s' => { name => 'unit', default => 's' } }); return $self; @@ -209,6 +210,9 @@ sub check_options { sub add_license { my ($self, %options) = @_; + return if (defined($self->{option_results}->{filter_category}) && $self->{option_results}->{filter_category} ne '' && + $options{name} !~ /$self->{option_results}->{filter_category}/); + $self->{licenses}->{ $options{name} } = { name => $options{name}, used => $options{used} @@ -300,6 +304,15 @@ Check license. =over 8 +=item B<--filter-category> + +Filter licenses by category ('primary', 'secondary', 'resource'). + +=item B<--unit> + +Select the unit for the expired license threshold. May be 's' for seconds, 'm' for minutes, +'h' for hours, 'd' for days, 'w' for weeks. Default is seconds. + =item B<--warning-status> Set warning threshold for status. @@ -310,11 +323,6 @@ You can use the following variables: %{status} Set critical threshold for status (Default: '%{status} eq "expired"'). You can use the following variables: %{status} -=item B<--unit> - -Select the unit for expires threshold. May be 's' for seconds, 'm' for minutes, -'h' for hours, 'd' for days, 'w' for weeks. Default is seconds. - =item B<--warning-*> B<--critical-*> Thresholds.