diff options
Diffstat (limited to 'examples/v3arch/asyncore/manager/cmdgen/custom-contextengineid-and-contextname.py')
-rw-r--r-- | examples/v3arch/asyncore/manager/cmdgen/custom-contextengineid-and-contextname.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/v3arch/asyncore/manager/cmdgen/custom-contextengineid-and-contextname.py b/examples/v3arch/asyncore/manager/cmdgen/custom-contextengineid-and-contextname.py index 2dc2ee8b..4ea68110 100644 --- a/examples/v3arch/asyncore/manager/cmdgen/custom-contextengineid-and-contextname.py +++ b/examples/v3arch/asyncore/manager/cmdgen/custom-contextengineid-and-contextname.py @@ -34,6 +34,7 @@ config.addV3User( snmpEngine, 'usr-md5-none', config.USM_AUTH_HMAC96_MD5, 'authkey1' ) + config.addTargetParams(snmpEngine, 'my-creds', 'usr-md5-none', 'authNoPriv') # @@ -47,6 +48,7 @@ config.addTransport( udp.DOMAIN_NAME, udp.UdpSocketTransport().openClientMode() ) + config.addTargetAddr( snmpEngine, 'my-router', udp.DOMAIN_NAME, ('104.236.166.95', 161), @@ -60,9 +62,11 @@ def cbFun(snmpEngine, sendRequestHandle, errorIndication, errorStatus, errorIndex, varBinds, cbCtx): if errorIndication: print(errorIndication) + elif errorStatus: print('%s at %s' % (errorStatus.prettyPrint(), errorIndex and varBinds[int(errorIndex) - 1][0] or '?')) + else: for oid, val in varBinds: print('%s = %s' % (oid.prettyPrint(), val.prettyPrint())) |