summaryrefslogtreecommitdiff
path: root/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-v1-trap.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-v1-trap.py')
-rw-r--r--examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-v1-trap.py35
1 files changed, 18 insertions, 17 deletions
diff --git a/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-v1-trap.py b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-v1-trap.py
index c6d84303..017fc8b8 100644
--- a/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-v1-trap.py
+++ b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/custom-v1-trap.py
@@ -24,24 +24,25 @@ Functionally similar to:
"""#
from pysnmp.hlapi import *
-errorIndication, errorStatus, errorIndex, varBinds = next(
- sendNotification(
- SnmpEngine(),
- CommunityData('public', mpModel=0),
- UdpTransportTarget(('demo.snmplabs.com', 162)),
- ContextData(),
- 'trap',
- NotificationType(
- ObjectIdentity('1.3.6.1.4.1.20408.4.1.1.2.0.432'),
- ).addVarBinds(
- ('1.3.6.1.2.1.1.3.0', 12345),
- ('1.3.6.1.6.3.18.1.3.0', '127.0.0.1'),
- ('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'),
- ('1.3.6.1.2.1.1.1.0', OctetString('my system'))
- ).loadMibs(
- 'SNMPv2-MIB', 'SNMP-COMMUNITY-MIB'
- )
+iterator = sendNotification(
+ SnmpEngine(),
+ CommunityData('public', mpModel=0),
+ UdpTransportTarget(('demo.snmplabs.com', 162)),
+ ContextData(),
+ 'trap',
+ NotificationType(
+ ObjectIdentity('1.3.6.1.4.1.20408.4.1.1.2.0.432'),
+ ).addVarBinds(
+ ('1.3.6.1.2.1.1.3.0', 12345),
+ ('1.3.6.1.6.3.18.1.3.0', '127.0.0.1'),
+ ('1.3.6.1.6.3.1.1.4.3.0', '1.3.6.1.4.1.20408.4.1.1.2'),
+ ('1.3.6.1.2.1.1.1.0', OctetString('my system'))
+ ).loadMibs(
+ 'SNMPv2-MIB', 'SNMP-COMMUNITY-MIB'
)
)
+
+errorIndication, errorStatus, errorIndex, varBinds = next(iterator)
+
if errorIndication:
print(errorIndication)