From 146894f16baf004e93de3fb0ea6afa24e3fa5c0f Mon Sep 17 00:00:00 2001 From: qgarnier Date: Tue, 8 Aug 2017 14:45:20 +0200 Subject: [PATCH] fix meraki --- .../cloudcontroller/snmp/mode/deviceusage.pm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/network/cisco/meraki/cloudcontroller/snmp/mode/deviceusage.pm b/network/cisco/meraki/cloudcontroller/snmp/mode/deviceusage.pm index c8a763234..818e5f097 100644 --- a/network/cisco/meraki/cloudcontroller/snmp/mode/deviceusage.pm +++ b/network/cisco/meraki/cloudcontroller/snmp/mode/deviceusage.pm @@ -302,15 +302,17 @@ sub manage_selection { status => $result->{devStatus}, clients => $result->{devClientCount}}; } - - $options{snmp}->load(oids => [$mapping2->{devInterfaceSentBytes}->{oid}, $mapping2->{devInterfaceRecvBytes}->{oid}], - instances => [keys %{$self->{interface}}], instance_regexp => '^(.*)$'); - $snmp_result = $options{snmp}->get_leef(nothing_quit => 1); - foreach (keys %{$self->{interface}}) { - my $result = $options{snmp}->map_instance(mapping => $mapping2, results => $snmp_result, instance => $_); - $self->{interface}->{$_}->{in} = $result->{devInterfaceRecvBytes} * 8; - $self->{interface}->{$_}->{out} = $result->{devInterfaceSentBytes} * 8; + if (scalar(keys %{$self->{interface}}) > 0) { + $options{snmp}->load(oids => [$mapping2->{devInterfaceSentBytes}->{oid}, $mapping2->{devInterfaceRecvBytes}->{oid}], + instances => [keys %{$self->{interface}}], instance_regexp => '^(.*)$'); + $snmp_result = $options{snmp}->get_leef(nothing_quit => 1); + foreach (keys %{$self->{interface}}) { + my $result = $options{snmp}->map_instance(mapping => $mapping2, results => $snmp_result, instance => $_); + + $self->{interface}->{$_}->{in} = $result->{devInterfaceRecvBytes} * 8; + $self->{interface}->{$_}->{out} = $result->{devInterfaceSentBytes} * 8; + } } $self->{cache_name} = "cisco_meraki_" . $self->{mode} . '_' . $options{snmp}->get_hostname() . '_' . $options{snmp}->get_port() . '_' .