From b30c944491838c1b0f55ac18c5d3abc9534a98ac Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Thu, 10 Dec 2015 17:51:27 +0100 Subject: [PATCH] + Enhance processcount mode to manage empty values (now you have to use regexp and '^$' syntax for empty) --- snmp_standard/mode/processcount.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/snmp_standard/mode/processcount.pm b/snmp_standard/mode/processcount.pm index dd8fc1cb3..e4c8c7d42 100644 --- a/snmp_standard/mode/processcount.pm +++ b/snmp_standard/mode/processcount.pm @@ -157,10 +157,10 @@ sub run { # $options{snmp} = snmp object $self->{snmp} = $options{snmp}; - my $oid2check_filter; + my $oid2check_filter = 'status'; # To have a better order foreach (('name', 'path', 'args', 'status')) { - if (defined($self->{option_results}->{'process_' . $_})) { + if (defined($self->{option_results}->{'process_' . $_}) && $self->{option_results}->{'process_' . $_} ne '') { $oid2check_filter = $_; last; } @@ -175,7 +175,7 @@ sub run { push @{$more_oids}, $oid_hrSWRunPerfCPU; } foreach (keys %$oids) { - if ($_ ne $oid2check_filter && defined($self->{option_results}->{'process_' . $_})) { + if ($_ ne $oid2check_filter && defined($self->{option_results}->{'process_' . $_}) && $self->{option_results}->{'process_' . $_} ne '') { push @{$more_oids}, $oids->{$_}; $mores_filters->{$_} = 1; }