interactive SNMP tool
Interactive SNMP tool.
Snimpy is a Python-based tool providing a simple interface to build SNMP query. Here is a very simplistic example that allows us to display the routing table of a given host:
load("IP-FORWARD-MIB") m=M("localhost", "public", 2) routes = m.ipCidrRouteNextHop for x in routes: net, netmask, tos, src = x print("%15s/%-15s via %-15s src %-15s" % (net, netmask, routes[x], src))
You can either use Snimpy interactively throught its console (derived from Python own console or from IPython if available) or write Snimpy scripts which are just Python scripts with some global variables available.
Free software: ISC license
Snimpy requires libsmi to work correctly. See the documentation for more information.
Snimpy is aimed at being the more Pythonic possible. You should forget that you are doing SNMP requests. Snimpy will rely on MIB to hide SNMP details. Here are some “features”:
MIB parser based on libsmi (through CFFI)
SNMP requests are handled by PySNMP (SNMPv1, SNMPv2 and SNMPv3 support)
scalars are just attributes of your session object
columns are like a Python dictionary and made available as an attribute
getting an attribute is like issuing a GET method
setting an attribute is like issuing a SET method
iterating over a table is like using GETNEXT
when something goes wrong, you get an exception
Switch to pysnmp-lextudio, a maintained fork of PySNMP.
Drop compatibility with Python 2.
Add items() in addition to iteritems() This is an iterator on Python 3 and return a list of items in Python 2.
Compatibility with Python 3.7.
Fix an issue with implied index when reusing indexes between tables.
Support for more recent versions of IPython.
Support for SNMPv3 context name.
Support for notification nodes (MIB only).
Fix IPython interactive shell.
Fix IPv6 handling for sessions.
Ability for a session to return None instead of raising an exception.
Ability to walk a table (if the first index is accessible).
Ability to do a partial walk (courtesy of Alex Unigovsky).
Fix thread-safety problem introduced in 0.8.6. This also undo any improvement advertised in 0.8.6 when using multiple threads. However, performance should be kept when using a single thread.
Ability to specify a module name when querying a manager.
Compatibility with PySNMP 4.3
Array-like interface for OIDs.
Ability to restrict lookups to a specific MIB: m[‘IF-MIB’].ifDescr.
Fix multithread support with SNMPv3 (with a performance impact).
Major speed improvement.
Major memory usage improvement.
Ability to set SMI search path (with mib.path())
Fix documentation build on Read the Doc.
Add a loose mode to manager to loosen type coercion.
More CFFI workarounds, including cross-compilation support.
Ability to override a node type.
Automatic workaround for “SNMP too big” error message.
Workaround a problem with CFFI extension installation.
Python 3.3 support. Pypy support.
Octet strings with a display hint are now treated differently than plain octet strings (unicode). Notably, they can now be set using the displayed format (for example, for MAC addresses).
SNMP support is now provided through PySNMP.
MIB parsing is still done with libsmi but through CFFI instead of a C module.
More unittests. Many bugfixes.
MacAddress SMI type support.
Support for IPython 0.12.
Ability to return None instead of getting an exception.
Thread safety and efficiency.
Compatibility with IPython 0.11.
Custom timeouts and retries.
Check conformity of loaded modules.
Allow to cache requests.
Provide a manual page.
Use a context manager to group SET requests.
First release on PyPI.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.