diff options
Diffstat (limited to 'examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py')
-rw-r--r-- | examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py index 5681d28c..c53f09e6 100644 --- a/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py +++ b/examples/hlapi/v3arch/asyncore/sync/agent/ntforg/v2c-trap-with-notification-objects.py @@ -20,22 +20,24 @@ Functionally similar to: """# from pysnmp.hlapi import * -errorIndication, errorStatus, errorIndex, varBinds = next( - sendNotification( - SnmpEngine(), - CommunityData('public'), - UdpTransportTarget(('demo.snmplabs.com', 162)), - ContextData(), - 'trap', - NotificationType( - ObjectIdentity('IF-MIB', 'linkUp'), - instanceIndex=(123,), - objects={('IF-MIB', 'ifIndex'): 123, - ('IF-MIB', 'ifAdminStatus'): 'up', - ('IF-MIB', 'ifOperStatus'): 'up'} - ) +iterator = sendNotification( + SnmpEngine(), + CommunityData('public'), + UdpTransportTarget(('demo.snmplabs.com', 162)), + ContextData(), + 'trap', + NotificationType( + ObjectIdentity('IF-MIB', 'linkUp'), + instanceIndex=(123,), + objects={ + ('IF-MIB', 'ifIndex'): 123, + ('IF-MIB', 'ifAdminStatus'): 'up', + ('IF-MIB', 'ifOperStatus'): 'up' + } ) ) +errorIndication, errorStatus, errorIndex, varBinds = next(iterator) + if errorIndication: print(errorIndication) |