Platform: Redhat 9
Python rpms: python-2.2.2-26, python-devel-2.2.2-26
net-snmp rpms: net-snmp-5.0.9-2.90.1,
net-snmp-devel-5.0.9-2.90.1
yapsnmp rpm: yapsnmp-0.7.8-1_rh90
Code:
import yapsnmp
yapsnmp.set_flag(PRINT_NUMERIC_OIDS)
result = yapsnmp.Session('192.168.15.211', 2,
'public').getbulk('.1.3.6.1.2.1.31.1.1.1.1')
Traceback:
[root@Appserver root]# ./test.py
Traceback (most recent call last):
File "./test.py", line 9, in ?
yapsnmp.set_flag(PRINT_NUMERIC_OIDS)
NameError: name 'PRINT_NUMERIC_OIDS' is not defined
Description:
I'm trying to get numeric OID output.
Am i calling set_flag incorrectly? yapsnmp fails when
trying to set the net-snmp flag. The code seems sound,
but i've heard that some version of net-snmp 5x have
problems. Does this look like a net-snmp library
problem to you or a module problem?
Also to test it, i've tried setting it in
/usr/lib/python2.2/site-packages/yapsnmp.py directly
where you set NUMERIC_TIMETICKS but i still get MIB
translation to text, which doesn't error but still
doesn't work. This is the output:
(('ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.1',
'Fa0/1'),
('ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.2',
'Fa0/2'),
('ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.3',
'Fa0/3'),
('ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.4',
'Fa0/4'),
('ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.5',
'Fa0/5'),
('ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.6',
'Fa0/6'),
('ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName.7',
'Fa0/7'),
...
Can you help?
Thanks for a great snmp python tool
Nick
Logged In: NO
Nick,
I'm having a similar problem. First thing that strikes me
is that you need to prefix PRINT_NUMERIC_OIDS with the
module name, i.e.
yapsnmp.set_flag(yapsnmp.PRINT_NUMERIC_OIDS)
However that still doesn't work. I still get strings back. :-(
(yapsnmp version 0.7.8 on Debian unstable/testing hybrid)
Darren