diff options
author | Ilya Etingof <etingof@gmail.com> | 2019-02-12 09:16:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-12 09:16:17 +0100 |
commit | b9a7b9c955df98b1e5eec250f418c3df3b7d0199 (patch) | |
tree | 3364eb15031352859586e8eb6aa49759a23f9c72 /examples/smi/agent/operations-on-managed-objects.py | |
parent | c5f7842c430ad3431bee793362ef11cff9f1e0de (diff) | |
download | pysnmp-git-b9a7b9c955df98b1e5eec250f418c3df3b7d0199.tar.gz |
Reformat example scripts for easier reading (#241)
Diffstat (limited to 'examples/smi/agent/operations-on-managed-objects.py')
-rw-r--r-- | examples/smi/agent/operations-on-managed-objects.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/smi/agent/operations-on-managed-objects.py b/examples/smi/agent/operations-on-managed-objects.py index 75b9a765..704a6be5 100644 --- a/examples/smi/agent/operations-on-managed-objects.py +++ b/examples/smi/agent/operations-on-managed-objects.py @@ -10,12 +10,10 @@ from pysnmp.smi import builder from pysnmp.smi import instrum from pysnmp.smi import exval from pysnmp.smi import error -from pysnmp import debug - -#debug.setLogger(debug.Debug('all')) def walkMib(): + def cbFun(varBinds, **context): err = context.get('error') if err: @@ -38,6 +36,7 @@ def walkMib(): } print('Read whole MIB (table walk)') + while not app_context['stop']: mibInstrum.readNextMibObjects(*app_context['varBinds'], cbFun=cbFun, app=app_context) @@ -103,6 +102,7 @@ def cbFun(varBinds, **context): err = context.get('errors', None) if err: print(err) + for oid, val in varBinds: print('%s = %s' % ('.'.join([str(x) for x in oid]), not val.isValue and 'N/A' or val.prettyPrint())) |