diff options
author | elie <elie> | 2014-06-17 05:46:57 +0000 |
---|---|---|
committer | elie <elie> | 2014-06-17 05:46:57 +0000 |
commit | 483c99653c66d6c05f7ac9d56f68d0c608468455 (patch) | |
tree | 59129b54ac3824107136c560fe230f8ec25be925 /examples/v3arch/asyncore/agent/ntforg/v3-trap.py | |
parent | 98173faed90854615f0c7b6cd765c086e26d3904 (diff) | |
download | pysnmp-git-483c99653c66d6c05f7ac9d56f68d0c608468455.tar.gz |
converted to the latest API that supports more data to be used
Diffstat (limited to 'examples/v3arch/asyncore/agent/ntforg/v3-trap.py')
-rw-r--r-- | examples/v3arch/asyncore/agent/ntforg/v3-trap.py | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/examples/v3arch/asyncore/agent/ntforg/v3-trap.py b/examples/v3arch/asyncore/agent/ntforg/v3-trap.py index d53ac598..bff341a3 100644 --- a/examples/v3arch/asyncore/agent/ntforg/v3-trap.py +++ b/examples/v3arch/asyncore/agent/ntforg/v3-trap.py @@ -59,21 +59,27 @@ config.addVacmUser(snmpEngine, 3, 'usr-md5-des', 'authPriv', (), (), (1,3,6)) # *** SNMP engine configuration is complete by this line *** -# Create default SNMP context where contextEngineId == SnmpEngineId +# Create Notification Originator App instance. +ntfOrg = ntforg.NotificationOriginator() + + # Create default SNMP context where contextEngineId == SnmpEngineId snmpContext = context.SnmpContext(snmpEngine) -# Create Notification Originator App instance. -ntfOrg = ntforg.NotificationOriginator(snmpContext) - # Build and submit notification message to dispatcher -ntfOrg.sendNotification( +ntfOrg.sendVarBinds( snmpEngine, # Notification targets 'my-notification', - # Trap OID (SNMPv2-MIB::coldStart) + # SNMP Context + snmpContext, + # contextName + '', + # notification name (SNMPv2-MIB::coldStart) (1,3,6,1,6,3,1,1,5,1), - # ( (oid, value), ... ) - ( ((1,3,6,1,2,1,1,5,0), v2c.OctetString('system name')), ) + # instance Index + None, + # additional var-binds: ( (oid, value), ... ) + [ ((1,3,6,1,2,1,1,5,0), v2c.OctetString('system name')) ] ) print('Notification is scheduled to be sent') |