SNMP library for Python¶
PySNMP is a cross-platform, pure-Python SNMP engine implementation. It features fully-functional SNMP engine capable to act in Agent/Manager/Proxy roles, talking SNMP v1/v2c/v3 protocol versions over IPv4/IPv6 and other network transports.
Despite its name, SNMP is not really a simple protocol. For instance its third version introduces complex and open-ended security framework, multilingual capabilities, remote configuration and other features. PySNMP implementation closely follows intricate system details and features bringing most possible power and flexibility to its users.
Note
snmpclitools, which older documentation described as shipping with
PySNMP, is a separate project and is not part of this one. The release
on PyPI depends on the pysnmp distribution, which is a different fork
from a different repository – installing it beside pysnmplib puts two
SNMP engines in one environment.
PySNMP is free and open-source software, distributed under a 2-clause BSD-style license. The source is at pysnmp/pysnmp.
Three other projects are maintained alongside it, and the organization site describes how they fit together:
the MIB distribution, which supplies the module definitions an engine resolves names against;
pysmi, the MIB compiler, installed with the
compileextra;pyasn1, the ASN.1 codec underneath both, installed with PySNMP itself.
PySNMP library development has been initially sponsored by a PSF grant.
Quick start¶
You already know something about SNMP and have no courage to dive into this implementation? Try out quick start page!
Documentation¶
- Documentation
- Library reference
- Errors and supporting types
- Breaking Changes
- MIB instrumentation takes
(varBind, **context) - The high-level API is snake_case, and camelCase is deprecated
- Python 3.10 is the minimum supported version
asyncoreandasynsockhave been removedpyasn1.compat.octetsis no longer usedpycryptodomeximports are now resolved lazily- Weak-crypto warnings are emitted at configuration time
pysmiAPI calls use snake_case- Corrected behaviour that may change results
- MIB instrumentation takes
- Security Considerations
- SMI table construction and cell addressing
- Serving values an agent has to wait for
- Device details report
- Diffie-Hellman USM key change
- MIB instance generation tools
- Loading MIBs from a corpus
- MIB module loader contract
- Logging and tracing contract
- Codec benchmark
Examples¶
Download¶
Best way is usually to
$ pip install pysnmplib
If that does not work for you for some reason, you might need to read the following page.
License¶
FAQ¶
- FAQ
- Getting peer address information
- How to implement MIB at the Agent
- Ignored SNMP packets
- Listening on multiple network interfaces
- Garbaged SNMP values (apps)
- Garbaged SNMP values (tools)
- Dealing with the “OID not increasing” error
- How to pass MIB to the Manager
- Resolve response values at MIB
- SNMP data constraints verification error
- Walking whole MIB
Further development¶
The changelog is generated from the commit history at release time. The narrative history of the project through 5.x is kept separately.
How changes reach a released version — the branches, the commit-message conventions, what CI runs and how a release is cut — is documented here.
Our development plans and new features we consider for eventual implementation are collected in the following section.
Contact¶
In case of questions or troubles using PySNMP, please open up an issue at GitHub or ask at Stack Overflow .