From 0ca496409b693f730f4753be3927458c8652567d Mon Sep 17 00:00:00 2001 From: Sims24 Date: Wed, 20 Jul 2016 15:48:50 +0200 Subject: [PATCH] + minor optimizations ++ enhance error management when filter by SSID ++ reduce snmp query scope --- network/aerohive/snmp/mode/connectedusers.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/network/aerohive/snmp/mode/connectedusers.pm b/network/aerohive/snmp/mode/connectedusers.pm index e7fc608b9..75ce6686e 100644 --- a/network/aerohive/snmp/mode/connectedusers.pm +++ b/network/aerohive/snmp/mode/connectedusers.pm @@ -76,7 +76,6 @@ sub new { return $self; } -my $oid_ahXIfEntry = '.1.3.6.1.4.1.26928.1.1.1.2.1.1.1'; my $oid_ahSSIDNAME = '.1.3.6.1.4.1.26928.1.1.1.2.1.1.1.2'; my $oid_ahClientSSID = '.1.3.6.1.4.1.26928.1.1.1.2.1.2.1.10'; @@ -86,13 +85,12 @@ sub manage_selection { $self->{global} = { total => 0 }; $self->{ssid} = {}; - $self->{results} = $options{snmp}->get_multiple_table(oids => [ { oid => $oid_ahXIfEntry }, + $self->{results} = $options{snmp}->get_multiple_table(oids => [ { oid => $oid_ahSSIDNAME }, { oid => $oid_ahClientSSID }, ], nothing_quit => 1); foreach my $oid (keys %{$self->{results}->{ $oid_ahXIfEntry }}) { - next if $oid !~ /^$oid_ahSSIDNAME\.(.*)$/; my $ssid = $self->{results}->{ $oid_ahXIfEntry }->{$oid}; if (defined($self->{option_results}->{filter_ssid}) && $self->{option_results}->{filter_ssid} ne '' && $ssid !~ /$self->{option_results}->{filter_ssid}/) { @@ -105,7 +103,7 @@ sub manage_selection { foreach my $oid (keys %{$self->{results}->{ $oid_ahClientSSID }}) { $self->{global}->{total}++; my $ssid = $self->{results}->{ $oid_ahClientSSID }->{$oid}; - $self->{ssid}->{$ssid}->{total}++; + $self->{ssid}->{$ssid}->{total}++ if defined($self->{ssid}->{$ssid}); } }