File: walk-whole-mib.rst

package info (click to toggle)
python-pysnmp4 4.4.6%2Brepack1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,388 kB
  • sloc: python: 19,792; makefile: 166; sh: 23
file content (26 lines) | stat: -rw-r--r-- 839 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

Walking whole MIB
-----------------

Q. The nextCmd() and bulkCmd() methods of CommandGenerator app 
   (oneliner version) stop working once returned OIDs went out of scope of 
   request OIDs. 
   
   In other words, if I request 1.3.6.1, I would get everything under 
   the 1.3.6.1 prefix, but not 1.3.6.2.  Is there any way to make it walking 
   the whole MIB?

A. Yes, just pass the lexicographicMode=True parameter to CommandGenerator 
   nextCmd() and bulkCmd() methods (introduced in PySNMP 4.2.3+) or set 
   CommandGenerator.lexicographicMode=True option before calling nextCmd() 
   and bulkCmd() methods.

.. code-block:: python

    cmdGen = cmdgen.CommandGenerator()
    errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.bulkCmd(
        ....,
        ....,
        ....,
        lexicographicMode=True
    )