Re: [pysnmp-users] Error sending traps
Brought to you by:
elie
From: Ilya E. <il...@gl...> - 2009-07-31 20:43:38
|
There seems to be a bug in example trap sender in pysnmp 4.1.9a. The right syntax is: errorIndication = ntforg.NotificationOriginator().sendNotification( cmdgen.UsmUserData('my-user', 'my-authkey', 'my-privkey'), cmdgen.UdpTransportTarget(('localhost', 162)), 'trap', (('SNMPv2-MIB', 'coldStart'),), ((1,3,6,1,2,1,1,3,0), v2c.TimeTicks(44100)) ) or better checkout pysnmp from CVS at SourceForge - it has many bugs fixed compared to 4.1.9a. -ilya [ skipped ] > So, I installed pysnmp 4.1.9a-1 on my Ubuntu box (using aptitude and Python > 2.5). Then I've read the documentation and tried to execute the SNMP Trap > example included on the documentation, to be more specifically, this one: > > ----- cut here ----- > > >>> from pysnmp.entity.rfc3413.oneliner import cmdgen, ntforg > >>> from pysnmp.proto.api import v2c > >>> errorIndication = ntforg.NotificationOriginator().sendNotification( > ... cmdgen.UsmUserData('my-user', 'my-authkey', 'my-privkey'), > ... cmdgen.UdpTransportTarget(('localhost', 162)), > ... 'trap', > ... ('SNMPv2-MIB', 'coldStart'), > ... ((1,3,6,1,2,1,1,3,0), v2c.TimeTicks(44100)) > ) > >>> print errorIndication > None > >>> print errorStatus > 0 > > ---- cut here ---- > > when executing the sendNotification, I'm getting this error: > > Traceback (most recent call last): > File "trap2.py", line 10, in <module> > ('SNMPv2-MIB', 'coldStart') > File"/var/lib/python-support/python2.5/pysnmp/v4/entity/rfc3413/oneliner/ntforg > .py", line 120, in sendNotification > (__cbFun, appReturn) > File"/var/lib/python-support/python2.5/pysnmp/v4/entity/rfc3413/oneliner/ntforg > .py", line 82, in asyncSendNotification > self.mibViewController, notificationType > File > "/var/lib/python-support/python2.5/pysnmp/v4/entity/rfc3413/mibvar.py", line > 31, in mibNameToOid > oid, label, suffix = mibView.getNodeNameByOid(name) > File "/var/lib/python-support/python2.5/pysnmp/v4/smi/view.py", line 196, > in getNodeNameByOid > (modName, nodeName, self) > pysnmp.smi.error.NoSuchObjectError: NoSuchObjectError({'str': "Can't resolve > node name ::('SNMPv2-MIB', 'coldStart') at > <pysnmp.smi.view.MibViewController instance at 0x8519ecc>"}) > > There is something that I'm missing? Why it can't resolve node name > ('SNMPv2-MIB','coldStart')? Is there a filepath or something that should be > set? > > And I'm getting other error, on other example, but if I can solve this one, > it will work perfectly for me! |