python - pysnmp 4.2.5 sending trap with object fails in sendPdu -


so i'm trying traps working in our project. using custom mib , walking works, sending traps without additional data works fine following code , object property removed trap in mib:

def sendeventtrap(self, event):     if(doprinttraps):         print "sending trap"     ntforg = ntforg.notificationoriginator(self._snmpcontext)     errorindication = ntforg.sendnotification(         self._snmpengine,         'trap',         ('project-mib', 'eventtrap'),         ()) 

now i'm trying add simple integer32 additional object so

def sendeventtrap(self, event):     if(doprinttraps):         print "sending trap"     ntforg = ntforg.notificationoriginator(self._snmpcontext)     errorindication = ntforg.sendnotification(         self._snmpengine,         'trap',         ('project-mib', 'eventtrap'),         [((1, 3, 6, 1, 4, 1, 999999, 3, 1, 0) , v2c.integer32(1337))]) 

however fails though according following log find , match right oid correctly associated integer32 type: http://pastebin.com/hj9laiag

this relevant part of mib:

eventnotifications object identifier ::= { xxx 4 }  eventtrap notification-type     objects     { direction }     status current     description "" ::= {eventnotifications 1} 

note function names have been changed privacy reasons. i'm @ loss here , appreciate inputs things going wrong.

i got working. there 2 problems.

  1. this functionality seems broken in 4.2.5 current code still fails key error. on 4.3.2 works well.
  2. the code above missing instanceindex=(0,) parameter , when sending managed object 1 doesn't have include varbind hand.

the following works declarations in questions mib:

ntforg = ntforg.notificationoriginator(self._snmpcontext) errorindication = ntforg.sendnotification(     self._snmpengine,     'trap',     ('project-mib', 'eventtrap'),     instanceindex=(0,)) 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -