summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2017-07-13 12:44:39 +0200
committerIlya Etingof <etingof@gmail.com>2017-07-13 12:50:12 +0200
commit89ac53ca3c493fc90be6bc31219c8e43e0c30ef1 (patch)
treeacc5a9ba40fad5e35174f7b4e8736e2681c1a605 /docs
parentee1f5a967fc0bbe56676d0f2176da12882f8ab3b (diff)
downloadpysnmp-git-89ac53ca3c493fc90be6bc31219c8e43e0c30ef1.tar.gz
updated the FAQ article on `ignoreNonIncreasingOid`
Diffstat (limited to 'docs')
-rw-r--r--docs/source/faq/oids-not-increasing.rst49
1 files changed, 33 insertions, 16 deletions
diff --git a/docs/source/faq/oids-not-increasing.rst b/docs/source/faq/oids-not-increasing.rst
index 681fd050..c1049eea 100644
--- a/docs/source/faq/oids-not-increasing.rst
+++ b/docs/source/faq/oids-not-increasing.rst
@@ -2,28 +2,45 @@
Dealing with OIDs not increasing error
--------------------------------------
-Q. I'm walking a particular Agent with the CommandGenerator.nextCmd()
- and CommandGenerator.bulkCmd() methods. It works for some OIDs, but
- invariably fails at certain OID with the 'OIDs are not increasing'
- diagnostics. What does it mean and how do I fix that?
+Q. I'm walking a particular Agent with the `nextCmd()` or `bulkCmd()`
+ functions. It works for some OIDs, but invariably fails at certain
+ OID with the *OIDs are not increasing* diagnostics. What does it mean and
+ how do I fix that?
-A. The Agent you are talking to seems to be broken. The 'OIDs are not
- increasing' message means that in the course of fetching OIDs from Agent,
- Manager receives an OID that is not greater than those used in request.
- Due to the nature of GETNEXT/GETBULK algorithm, passing the same or
+A. The Agent you are talking to seems to be broken. The
+ *OIDs are not increasing* message means that in the course of fetching
+ OIDs from Agent, Manager receives an OID that is not greater than those
+ used in request.
+ Due to the nature of GETNEXT/GETBULK algorithm, passing the same or
lesser OID to Manager would result in fetching the same set of OIDs over
and over again effectively creating an infinite loop between Manager
and Agent so they may never reach the end of MIB. So Manager tries
- to intervene and prevent loop from happenning.
+ to intervene and prevent loop from happening.
- If have to work with a broken Agent and prepared some other mean
- for stopping GETNEXT/GETBULK app at some point, you could set the
- ignoreNonIncreasingOid option at CommandGenerator class instance
- to disable OID verification on Manager side.
+ If you have to work with a broken Agent and can terminate the
+ GETNEXT/GETBULK app at some point, you can pass the
+ `ignoreNonIncreasingOid` keyword parameter to the `nextCmd()` or `bulkCmd()`
+ to disable OID verification at the Manager side.
.. code-block:: python
- cmdGen = cmdgen.CommandGenerator()
- cmdGen.ignoreNonIncreasingOid = True
- errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.bulkCmd(...)
+ for (errorIndication,
+ errorStatus,
+ errorIndex,
+ varBinds) in nextCmd(SnmpEngine(),
+ CommunityData('public'),
+ UdpTransportTarget(('demo.snmplabs.com', 161)),
+ ContextData(),
+ ObjectType(ObjectIdentity('1.3.6')),
+ ignoreNonIncreasingOid=True):
+ if errorIndication:
+ print(errorIndication)
+ break
+ elif errorStatus:
+ print('%s at %s' % (errorStatus.prettyPrint(),
+ errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
+ break
+ else:
+ for varBind in varBinds:
+ print(' = '.join([x.prettyPrint() for x in varBind])