pysnmp-mirror /

Filename Size Date modified Message
2.3 KB
1.5 KB
3.4 KB
5.1 KB
2.2 KB
1.1 KB

This is an alpha-quality revision of pure-Python, open source and free
implementation of v1/v2c/v3 SNMP engine.

The PySNMP project has been sponsored by a PSF grant [10]. Thanks!


* Complete SNMPv1/v2c and SNMPv3 support
* SMI framework for resolving MIB information and managing MIB objects
* Complete SNMP entity implementation
* Extensible network transports framework (UDP and UNIX domain implemented)
* Asynchronous socket-based IO API support
* 100% Python, works with Python 1.5 and later
* MT-safe

Features, specific to SNMPv3 model include:

* USM authentication (MD5/SHA) and privacy (DES) protocols (RFC3414)
* View-based access control to use with any SNMP model (RFC3415)
* Built-in SNMP proxy PDU converter for building multi-lingual
  SNMP entities (RFC2576)
* Remote SNMP engine configuration
* Optional SNMP engine discovery
* Shipped with standard SNMP applications (RC3413)  


* Much slower than C implementations. Some optimization still possible.
* No pure-Python MIB compiler. But there's a workaround, read on.


The 4.x revision of PySNMP brings an alpha-quality code, unstable APIs and
appears to run rather slow. Also, the 4.x APIs are quite incompatible
with their 2.x/3.x counterparts as of this early release. Chances are that,
at least, high-level compatibility interfaces would appear in future stable


The PySNMP package uses distutils for package management. The PyASN1 [8]
package is required. For secure SNMPv3 communication, PyyCrypto [9]
should also be installed.


As of this writing, PySNMP implements two SNMP architectures -- the first
is a legacy one specified by SNMPv1 & v2c standards [5]. It is quite 
low-level and protocol-oriented by design. In particular, it requires
application to manage transport failures, access issues and so on.

The second model supported by PySNMP is aligned to SNMPv3 architecture, 
as specified in [4]. Here is an example on querying SNMP agent
for arbitrary value (sysDescr) over SNMP v3 with authentication and 
privacy enabled:

8X---------------- cut here --------------------

from pysnmp.entity.rfc3413.oneliner import cmdgen

userData = cmdgen.UsmUserData('test-user', 'authkey1', 'privkey1')
targetAddr = cmdgen.UdpTransportTarget(('localhost', 161))

errorIndication, errorStatus, \
                 errorIndex, varBinds = cmdgen.CommandGenerator().getCmd(
    userData, targetAddr, (('SNMPv2-MIB', 'sysDescr'), 0)

if errorIndication: # SNMP engine errors
    print errorIndication
    if errorStatus: # SNMP agent errors
        print '%s at %s\n' % (errorStatus, varBinds[int(errorIndex)-1])
        for varBind in varBinds: # SNMP agent values
            print '%s = %s' % varBind

8X---------------- cut here --------------------

For more examples, please see the examples directory in the PySNMP distribution.


The pysnmp.smi sub-package defines and implements data model for SNMP SMI
objects. With that model, various objects defined in MIB file could be
implemented in Python, loaded into SNMP entity and used for verification and
visualisation purposes (SNMP manager side) and/or become management targets
(SNMP agent side).

While MIB parser/codegenerator has not been implemented in PySNMP, the
smidump tool of libsmi library [6] could be used for automatic convertion
of MIB text files into Python code. The code been generated relies upon
PySNMP SMI library.

In order to convert MIB text files into pysnmp.smi-compliant Python source,
please, use the pysnmp/tools/ utility. Review its source code
before use.

A large set of pre-compiled MIB files is shipped along the pysnmp-mibs


The PySNMP software is freely available for download from project's homepage.[1]


If something does not work as expected, please, try browsing PySNMP
mailing list archives or post your question there. [7]


I'm interested in bug reports and fixes, suggestions and improvements.
I'd be happy knowning whenever you used the PySNMP software for whatever
purpose. Please, send me a note then. Thanks!


[1] PySNMP project homepage:

[2] Pre-compiled PySNMP MIB modules:

[3] PySNMP applications:

[4] SNMP Version 3 specification and related

[5] SNMP Version 1/2 specifications: - -

[6] libsmi homepage

[7] PySNMP mailing list archives:

[8] PyASN1 project homepage:

[9] PyCrypto project:

[10] Python Software Foundation

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.