diff options
author | Ilya Etingof <etingof@gmail.com> | 2017-12-03 20:19:38 +0100 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2017-12-03 20:21:05 +0100 |
commit | 114e90414d41a5868ace60fd5d2902a0d9b9c732 (patch) | |
tree | db071875a09e44895c4f06459734b26af91c637c /examples | |
parent | 02941722866f0cc8d35dabfb82a3b6c16eabda8b (diff) | |
download | pysnmp-git-114e90414d41a5868ace60fd5d2902a0d9b9c732.tar.gz |
skip printing out non-initialized MIB objects in example MIB walk
Diffstat (limited to 'examples')
-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 b2373829..7d1f300c 100644 --- a/examples/smi/agent/operations-on-managed-objects.py +++ b/examples/smi/agent/operations-on-managed-objects.py @@ -33,16 +33,16 @@ varBinds = mibInstrum.writeVars( (snmpCommunityEntry.name + (7,) + instanceId, 'volatile')) ) for oid, val in varBinds: - print('%s = %s' % ('.'.join([str(x) for x in oid]), val.prettyPrint())) + print('%s = %s' % ('.'.join([str(x) for x in oid]), not val.isValue and 'N/A' or val.prettyPrint())) print('done') print('Read whole MIB (table walk)') oid, val = (), None -while 1: +while True: oid, val = mibInstrum.readNextVars(((oid, val),))[0] if exval.endOfMib.isSameTypeWith(val): break - print('%s = %s' % ('.'.join([str(x) for x in oid]), val.prettyPrint())) + print('%s = %s' % ('.'.join([str(x) for x in oid]), not val.isValue and 'N/A' or val.prettyPrint())) print('done') print('Unloading MIB modules...'), |