ruby-snmp icon indicating copy to clipboard operation
ruby-snmp copied to clipboard

Infinite loop on no such name error

Open rbur004 opened this issue 6 years ago • 0 comments

For some hosts, if :ignore_oid_order=>true, I'm getting an infinite loop from walk, with the last oid being returned over and over, but with a NULL value, after the first time.

When :ignore_oid_order=>false, then for these same hosts, I get "warning: OIDs are not increasing, ...', and the oid given in the error is the last one I got.

Comparing the output with the snmpwalk client, I get 'End of MIB' at the end of the output for the hosts that the gem loops infinitely for, but not for the hosts that work with the snmp gem.

snmpwalk only prints 'End of MIB' when it gets a no such name response.

Ruby test code ifTable_columns = ["SNMPv2-SMI::enterprises.41112.1.4.7.1"] #Newer firmware on rest of routers. SNMP::Manager.open(:host => host_ip, :community => "#{community}", :version => :SNMPv1, :ignore_oid_order=>true ) do |manager| manager.walk(ifTable_columns) do |row| puts row end end

Outputting:

[name=SNMPv2-SMI::enterprises.41112.1.4.7.1.1.1.0.21.109.26.46.109, value=m.m (OCTET STRING)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.2.1.0.21.109.26.46.109, value=wikk-b17 (OCTET STRING)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.3.1.0.21.109.26.46.109, value=-60 (INTEGER)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.4.1.0.21.109.26.46.109, value=-86 (INTEGER)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.5.1.0.21.109.26.46.109, value=1350 (INTEGER)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.6.1.0.21.109.26.46.109, value=98 (INTEGER)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.7.1.0.21.109.26.46.109, value=0 (INTEGER)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.8.1.0.21.109.26.46.109, value=95 (INTEGER)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.9.1.0.21.109.26.46.109, value=86 (INTEGER)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.10.1.0.21.109.26.46.109, value=100.64.0.241 (IpAddress)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.11.1.0.21.109.26.46.109, value=175500000 (INTEGER)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.12.1.0.21.109.26.46.109, value=195000000 (INTEGER)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.13.1.0.21.109.26.46.109, value=85369496756 (Counter64)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.14.1.0.21.109.26.46.109, value=11572287085 (Counter64)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.15.1.0.21.109.26.46.109, value=3 days, 20:01:47.00 (TimeTicks)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.15.1.0.21.109.26.46.109, value=Null (Null)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.15.1.0.21.109.26.46.109, value=Null (Null)] [name=SNMPv2-SMI::enterprises.41112.1.4.7.1.15.1.0.21.109.26.46.109, value=Null (Null)] ...

The command line snmpwalk output. Note 'End of MIB' is printed. See (https://github.com/winlibs/net-snmp/blob/master/apps/snmpwalk.c)

root@db:/tmp # snmpwalk -c xxxxx -v 1 xxxxxx SNMPv2-SMI::enterprises.41112.1.4.7.1 SNMPv2-SMI::enterprises.41112.1.4.7.1.1.1.0.21.109.26.46.109 = Hex-STRING: 00 15 6D 1A 2E 6D SNMPv2-SMI::enterprises.41112.1.4.7.1.2.1.0.21.109.26.46.109 = STRING: "wikk-b17" SNMPv2-SMI::enterprises.41112.1.4.7.1.3.1.0.21.109.26.46.109 = INTEGER: -59 SNMPv2-SMI::enterprises.41112.1.4.7.1.4.1.0.21.109.26.46.109 = INTEGER: -86 SNMPv2-SMI::enterprises.41112.1.4.7.1.5.1.0.21.109.26.46.109 = INTEGER: 1350 SNMPv2-SMI::enterprises.41112.1.4.7.1.6.1.0.21.109.26.46.109 = INTEGER: 98 SNMPv2-SMI::enterprises.41112.1.4.7.1.7.1.0.21.109.26.46.109 = INTEGER: 0 SNMPv2-SMI::enterprises.41112.1.4.7.1.8.1.0.21.109.26.46.109 = INTEGER: 95 SNMPv2-SMI::enterprises.41112.1.4.7.1.9.1.0.21.109.26.46.109 = INTEGER: 89 SNMPv2-SMI::enterprises.41112.1.4.7.1.10.1.0.21.109.26.46.109 = IpAddress: 100.64.0.241 SNMPv2-SMI::enterprises.41112.1.4.7.1.11.1.0.21.109.26.46.109 = INTEGER: 195000000 SNMPv2-SMI::enterprises.41112.1.4.7.1.12.1.0.21.109.26.46.109 = INTEGER: 195000000 SNMPv2-SMI::enterprises.41112.1.4.7.1.13.1.0.21.109.26.46.109 = Counter64: 85737329070 SNMPv2-SMI::enterprises.41112.1.4.7.1.14.1.0.21.109.26.46.109 = Counter64: 11594182988 SNMPv2-SMI::enterprises.41112.1.4.7.1.15.1.0.21.109.26.46.109 = Timeticks: (33290500) 3 days, 20:28:25.00 End of MIB

rbur004 avatar Dec 01 '19 04:12 rbur004