summaryrefslogtreecommitdiff
path: root/examples/v3arch/agent/ntforg/inform-v2c.py
diff options
context:
space:
mode:
authorelie <elie>2014-06-17 05:46:57 +0000
committerelie <elie>2014-06-17 05:46:57 +0000
commitdad702f69446abcbcf32584743beb47f4583e0cd (patch)
treedce4559a9651d3cb6e361b1382e15e84fd306836 /examples/v3arch/agent/ntforg/inform-v2c.py
parent6acd5123d163c9af8d529309842d0e7b6fecc4c4 (diff)
downloadpysnmp-dad702f69446abcbcf32584743beb47f4583e0cd.tar.gz
converted to the latest API that supports more data to be used
Diffstat (limited to 'examples/v3arch/agent/ntforg/inform-v2c.py')
-rw-r--r--examples/v3arch/agent/ntforg/inform-v2c.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/examples/v3arch/agent/ntforg/inform-v2c.py b/examples/v3arch/agent/ntforg/inform-v2c.py
index 0d46c12..08993b0 100644
--- a/examples/v3arch/agent/ntforg/inform-v2c.py
+++ b/examples/v3arch/agent/ntforg/inform-v2c.py
@@ -56,29 +56,36 @@ config.addVacmUser(snmpEngine, 2, 'my-area', 'noAuthNoPriv', (), (), (1,3,6))
# *** SNMP engine configuration is complete by this line ***
+# 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)
-
# Error/confirmation receiver
-def cbFun(sendRequestHandle, errorIndication, cbCtx):
+def cbFun(snmpEngine, sendRequestHandle, errorIndication,
+ errorStatus, errorIndex, varBinds, cbCtx):
print('Notification %s, status - %s' % (
sendRequestHandle, errorIndication and errorIndication or 'delivered'
)
)
# Build and submit notification message to dispatcher
-sendRequestHandle = ntfOrg.sendNotification(
+sendRequestHandle = 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,1,0), v2c.OctetString('Example Notificator')),
- ((1,3,6,1,2,1,1,5,0), v2c.OctetString('Notificator Example')) ),
+ # instance Index
+ None,
+ # additional var-binds: ( (oid, value), ... )
+ [ ((1,3,6,1,2,1,1,1,0), v2c.OctetString('Example Notificator')),
+ ((1,3,6,1,2,1,1,5,0), v2c.OctetString('Notificator Example')) ],
cbFun
)