Hi,
I just started experimenting with the Python bindings and I noticed a behaviour
that looks like a bug when I’m using snmpwalk().
This is under Net-SNMP 5.5.2 on CentOS 6, 64 bits and python 2.7.
First I’ll show an example of everything working as expected:
If I “walk” through an index, for example: IF-MIB::ifIndex
— begins —
import netsnmp
oid = netsnmp.VarList(netsnmp.Varbind('IF-MIB::ifIndex'))
s = netsnmp.Session(DestHost=‘myhost', Community=‘mycommunity', Version=2)
s.walk(oid)
— ends —
I get the following output (debug enabled):
$ python2.7 test.py
netsnmp_walk: filling request: IF-MIB::ifIndex::10:0
netsnmp_walk: filling response: ifIndex:1
netsnmp_walk: filling response: ifIndex:2
netsnmp_walk: filling response: ifIndex:3
netsnmp_walk: filling response: ifIndex:4
netsnmp_walk: filling response: ifIndex:5
In that case, I get “tag” is the same for all returned OIDs, and “iid” is
incrementing. The same behaviour happens if I use “UseNumeric” and
“UseLongNames”:
— begins —
import netsnmp
oid = netsnmp.VarList(netsnmp.Varbind('IF-MIB::ifIndex'))
s = netsnmp.Session(DestHost=‘myhost', Community=‘mycommunity', Version=2)
s.UseLongNames = 1
s.UseNumeric = 1
s.walk(oid)
— ends —
The output is:
$ python2.7 test.py
netsnmp_walk: filling request: IF-MIB::ifIndex::10:0
netsnmp_walk: filling response: .1.3.6.1.2.1.2.2.1.1:1
netsnmp_walk: filling response: .1.3.6.1.2.1.2.2.1.1:2
netsnmp_walk: filling response: .1.3.6.1.2.1.2.2.1.1:3
netsnmp_walk: filling response: .1.3.6.1.2.1.2.2.1.1:4
netsnmp_walk: filling response: .1.3.6.1.2.1.2.2.1.1:5
However, if instead of IF-MIB, I use Dell’s "MIB-Dell-10892” (without the MIB
actually being installed, using numeric OID), here’s what I get:
First, without “UseLongNames” and “UseNumeric”:
— begins —
import netsnmp
oid = netsnmp.VarList(netsnmp.Varbind('.1.3.6.1.4.1.674.10892.1.1100.30.1.1.1'))
s = netsnmp.Session(DestHost=‘myhost', Community=‘mycommunity', Version=2)
s.walk(oid)
— ends —
Output:
$ python2.7 test.py
netsnmp_walk: filling request: .1.3.6.1.4.1.674.10892.1.1100.30.1.1.1::14:0
__get_type_str:FAILURE(0)
__get_type_str:FAILURE(0)
netsnmp_walk: filling response: enterprises.674.10892.1.1100.30.1.1.1.1:
__get_type_str:FAILURE(0)
__get_type_str:FAILURE(0)
netsnmp_walk: filling response: enterprises.674.10892.1.1100.30.1.1.1.2:
Note that in this case, “tag” was merged with “iid” and “iid” was left blank,
however, if I use “UseNumeric” and “UseLongNames”, it works as expected:
— begins —
import netsnmp
oid = netsnmp.VarList(netsnmp.Varbind('.1.3.6.1.4.1.674.10892.1.1100.30.1.1.1'))
s = netsnmp.Session(DestHost=‘myhost', Community=‘mycommunity', Version=2)
s.UseLongNames = 1
s.UseNumeric = 1
s.walk(oid)
— ends —
$ python2.7 test.py
netsnmp_walk: filling request: .1.3.6.1.4.1.674.10892.1.1100.30.1.1.1::14:0
__get_type_str:FAILURE(0)
__get_type_str:FAILURE(0)
netsnmp_walk: filling response: .1.3.6.1.4.1.674.10892.1.1100.30.1.1.1:1
__get_type_str:FAILURE(0)
__get_type_str:FAILURE(0)
netsnmp_walk: filling response: .1.3.6.1.4.1.674.10892.1.1100.30.1.1.1:2
Has anyone else encountered this kind of behaviour? I’m willing to go through
the “client_intf.c” and try to fix this, but I’d like to hear from people with
a similar setup and/or more experience with the python bindings.
Thank you
Eduardo Bragatto
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users