yapsnmp: Yet Another Python SNMP module

yapsnmp is a Python SNMP module based on the net-snmp (formerly known as ucd-snmp) library. It's composed of a low level interface to the library, created using SWIG, and a higher level python module removing all the complexity out of dealing with SNMP.

Here are a list of the key features the module currently supports:

You're only requirements are Python (tested with versions 1.5.2 through 2.2.x) and net-snmp (requires version 5.x).

Latest News

New version 0.7.8: Finally adapted the code to use net-snmp 5.x, as well as creating an RPM spec file. I've prepared a few RPMs for some common platforms, check the download section.

New version 0.7.6: Fixed a nasty bug breaking return variable value processing using the default flags (introduced in 0.7.5). Modified to work using the new snprint_* functions introduced in net-snmp 4.2.5, instead of the sprint_*, because sprint_value() in 4.2.5 is broken (I've submitted a bug report) due to a typo. Unfortunately this breaks back compatibility with versions prior to 4.2.5.

New to 0.7.5: Removed the set_numeric_enums(), set_numeric_oids() and set_numeric_timeticks() functions, and replaced them by the more generic and versatile: set_flag(), get_flag(), clear_flag() and define_flag(). This now allows full access to all the Net-SNMP Boolean flags. In addition, the default is now to use the QUICK_PRINT flag of Net-SNMP, so the output will no longer contain such things as "Counter64", "Gauge32", etc... but just the numeric value (the old behavior can of course be obtained by a clear_flag(QUICK_PRINT) just after importing the module).

Examples

Perform an SNMPv1 walk on the system tree (result is a tuple of tuples):

yapsnmp.Session('router45-ny').walk('system')

Obtain ifHCInOctets.12 and ifOperStatus.12 in one packet using SNMPv2c:

yapsnmp.Session('tapioca', version=2).get('ifHCInOctets.12', 'ifOperStatus.12')

Stability

I'm running some code based on yapsnmp that collects 4 million variables per day, and has been doing so for over several years without a single problem.

Licensing

The yapsnmp software is distributed under the terms and conditions of the Free Software Foundation's LGPL.


Yves Perrenoud