Hello,
I am using snmpwalk.py from pysnmp-apps 0.4.0 to make SNMP requests on CISCO-RTTMON-MIB.
I noticed that on each and every snmpwalk request issued I have one extra junk entry at the end, see this example:
snmpwalk.py -v2c -Cp -c public localhost:16100 1.3.6.1.4.1.9.9.42.1.5.2.1.1
SNMPv2-SMI::enterprises.9.9.42.1.5.2.1.1.1 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.42.1.5.2.1.1.4 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.42.1.5.2.1.2.1 = Gauge32: 0
Variables found: 3
I am expecting only the 2 first entries to be present, notice that 1.3.6.1.4.1.9.9.42.1.5.2.1.1 is not a prefix of 1.3.6.1.4.1.9.9.42.1.5.2.1.2.1.
I had a quick look at snmpwalk.py, and I have the feeling that the issue lies inside cbFun() method:
for oid, val in varBindRow: colIdx = colIdx + 1 sys.stdout.write('%s\n' % cbCtx['mibViewProxy'].getPrettyOidVal( cbCtx['mibViewController'], oid, val ) ) if cbCtx['myHeadVars'][colIdx].isPrefixOf(oid): inTableFlag = 1 if cbCtx.get('reportFoundVars'): cbCtx['reportFoundVars'] = cbCtx['reportFoundVars'] + len(varBindRow) if not inTableFlag: return # stop on end-of-table
Here you print the value (and also increase the counter) before actually checking if it is a prefix.
Let me know if I missed something!
Thank you,
Martin
Fixed in 0.4.1
Thanks for reporting!