diff options
author | Mike C. Fletcher <mcfletch@vrplumber.com> | 2018-01-13 13:09:10 -0500 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2018-01-13 19:09:10 +0100 |
commit | 3760e7b6388a95c01c70292259759f75ef767a6d (patch) | |
tree | 50ee3ea85f3b5ceab36e7b0b90bfe89220eee32c /docs | |
parent | 0ab27d2c38559e81f480d264a7b0f1ccc854c675 (diff) | |
download | pysnmp-git-3760e7b6388a95c01c70292259759f75ef767a6d.tar.gz |
Some documentation clarifications (#125)
* Doc Update: in resolveWithMib docstring, document getting controller
* Expand on the "use mibbuilder" comment as to *how* to use it
Basically how to make the modules you compile with mibbuilder
available to your application via MibBuilder settings
* Add a note explaining that "ASN.1 MIB" means the textual format
Users of the library seeing "ASN.1" may assume (as I did) that
the meaning is "ASN.1 encoded binary version of the MIB" (i.e.
a precompiled version of the MIB in compact internal format).
* Describe how to configure all OIDs to use the ASN.1 mib directories
Diffstat (limited to 'docs')
-rw-r--r-- | docs/source/docs/pysnmp-hlapi-tutorial.rst | 7 | ||||
-rw-r--r-- | docs/source/faq/pass-custom-mib-to-manager.rst | 29 |
2 files changed, 35 insertions, 1 deletions
diff --git a/docs/source/docs/pysnmp-hlapi-tutorial.rst b/docs/source/docs/pysnmp-hlapi-tutorial.rst index 54bb6e5e..60814578 100644 --- a/docs/source/docs/pysnmp-hlapi-tutorial.rst +++ b/docs/source/docs/pysnmp-hlapi-tutorial.rst @@ -247,6 +247,13 @@ in the examples. We maintain a `collection <http://mibs.snmplabs.com/asn1/>`_ of ASN.1 MIB modules that you can use in your SNMP projects. +.. note:: + + An "ASN.1 MIB" is a plain-text description of identifiers and + types. It is the common format that is distributed by manufacturers + to describe their SNMP services, and is the same format used by + Perl's Net::SNMP and almost all SNMP tools. + Reading scalar value -------------------- diff --git a/docs/source/faq/pass-custom-mib-to-manager.rst b/docs/source/faq/pass-custom-mib-to-manager.rst index a83e9307..51c59ba6 100644 --- a/docs/source/faq/pass-custom-mib-to-manager.rst +++ b/docs/source/faq/pass-custom-mib-to-manager.rst @@ -21,9 +21,36 @@ A. Starting from PySNMP 4.3.x, plain-text (ASN.1) MIBs can be :start-after: """# :language: python +.. code: + :language: python + + # Configure the SNMP engine with access to the + # common Linux ASN.1 (Textual) MIB directories... + from pysnmp import hlapi + from pysnmp.smi import compiler + engine = hlapi.Engine() + builder = engine.getMibBuilder() + compiler.addMibCompiler(builder, sources=[ + '/usr/share/snmp/mibs', + os.path.expanduser('~/.snmp/mibs'), + 'http://mibs.snmplabs.com/asn1/@mib@', + ]) + :download:`Download</../../examples/hlapi/asyncore/sync/manager/cmdgen/custom-asn1-mib-search-path.py>` script. Alternatively, you can invoke the `mibdump.py <http://snmplabs.com/pysmi/mibdump.html>`_ (shipped with PySMI) by hand and this way compile plain-text MIB -into PySNMP format. +into PySNMP format. Once the compiled MIBs are stored in a directory, +add the directory to your MibBuilder's MibSources. + +.. code:: + :language: python + + builder = engine.getMibBuilder() + # Make ./mibs available to all OIDs that are created + # e.g. with "MIB-NAME-MIB::identifier" + builder.addMibSources(builder_module.DirMibSource( + os.path.join( HERE, 'mibs') + )) + |