summaryrefslogtreecommitdiff
path: root/examples/v3arch/asyncore/agent/ntforg/send-trap-to-multiple-managers.py
diff options
context:
space:
mode:
authorelie <elie>2015-05-31 19:35:10 +0000
committerelie <elie>2015-05-31 19:35:10 +0000
commit27c1c8ef97a43f5b6446f09400d0a941564ffbcf (patch)
tree779d7ed0f6e11b93d6628d62c94b3858c027fe93 /examples/v3arch/asyncore/agent/ntforg/send-trap-to-multiple-managers.py
parentcbcda159023cd6101328713ba2b6fe5c2a4ed1c7 (diff)
downloadpysnmp-git-27c1c8ef97a43f5b6446f09400d0a941564ffbcf.tar.gz
Major overhaul related to PySMI integration and Standard SNMP Applications
API redesign: * MibVariable becomes ObjectIdentity and moves to pysnmp.smi.rfc1902 * ObjectType and NotificationType classes resempling corresponding MIB MACROs implemented * SNMP Standard Applications and examples modified to support ObjectType and NotificationType parameters
Diffstat (limited to 'examples/v3arch/asyncore/agent/ntforg/send-trap-to-multiple-managers.py')
-rw-r--r--examples/v3arch/asyncore/agent/ntforg/send-trap-to-multiple-managers.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/examples/v3arch/asyncore/agent/ntforg/send-trap-to-multiple-managers.py b/examples/v3arch/asyncore/agent/ntforg/send-trap-to-multiple-managers.py
index 0ca3d702..cd6432b5 100644
--- a/examples/v3arch/asyncore/agent/ntforg/send-trap-to-multiple-managers.py
+++ b/examples/v3arch/asyncore/agent/ntforg/send-trap-to-multiple-managers.py
@@ -16,7 +16,7 @@
#
from pysnmp.entity import engine, config
from pysnmp.carrier.asynsock.dgram import udp
-from pysnmp.entity.rfc3413 import ntforg, context
+from pysnmp.entity.rfc3413 import ntforg
from pysnmp.proto.api import v2c
# Create SNMP engine instance
@@ -70,22 +70,23 @@ config.addVacmUser(snmpEngine, 2, 'my-area', 'noAuthNoPriv', (), (), (1,3,6))
# *** SNMP engine configuration is complete by this line ***
-# Create default SNMP context where contextEngineId == SnmpEngineId
-snmpContext = context.SnmpContext(snmpEngine)
-
# Create Notification Originator App instance.
-ntfOrg = ntforg.NotificationOriginator(snmpContext)
+ntfOrg = ntforg.NotificationOriginator()
# Build and submit notification message to dispatcher
-ntfOrg.sendNotification(
+ntfOrg.sendVarBinds(
snmpEngine,
# Notification targets
- 'my-notification',
- # Trap OID (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')) )
+ 'my-notification', # notification targets
+ None, '', # contextEngineId, contextName
+ # var-binds
+ [
+ # SNMPv2-SMI::snmpTrapOID.0 = SNMPv2-MIB::coldStart
+ ((1,3,6,1,6,3,1,1,4,1,0), v2c.ObjectIdentifier((1,3,6,1,6,3,1,1,5,1))),
+ # 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'))
+ ]
)
print('Notifications are scheduled to be sent')