TwistedSNMP
TwistedSNMP is a set of SNMP protocol implementations for Python's
Twisted Matrix networking framework using the PySNMP project. It
provides the following:
- get, set, getnext and getbulk Manager-side queries
- get, set, getnext and getbulk Agent-side services
Eventual goals of the system:
- provide access to all v1 and v2 SNMP functionality for writing
Agent and Manager services
- provide convenient testing mechanisms for SNMP Agent/Manager
development (e.g. mirroring an SNMP Agent's OID tree for local query
testing)
Once complete, we can look at either incorporating the system into
the PySNMP or Twisted distribution. For now, you can download
TwistedSNMP from the project page.
Installation
TwistedSNMP is distributed as a Python distutils package. You
can install it by unpacking the source distribution and running:
setup.py install
In the top level of the install directory. You will need both Twisted and PySNMP 3.x installed
Documentation
At the moment, most of the documentation for the module is in the
form of the auto-generated PyDoc
reference API, which includes auto-generated documentation for PySNMP. You can find usage examples
in the test sub-directory of the distribution.
Changes
Version 0.2.10
- Rewrite table-retrieval results-handling to be more robust and
simple
Version 0.2.9
- Catch socket errors during message sending and report as Twisted
failures (otherwise the errors simply print exceptions and are ignored,
which can hang client code that expects (rightly) an eventual return
value from something which calls a TwistedSNMP method).
Version 0.2.8
- BSDOIDStore.close method added to actually save data to disk
(useful, that :) )
- Modifications to MirrorAgent to call close on OID store
- Bug-fixes in both OIDStore classes (old BSDDB data-files will be
incompatible as a result)
- Essentially, the OIDs were being stored in too naive an order,
so the oid 0.1.2 would sort after 0.1.12, i.e. using simple string
sorting
- BisectOIDStore now uses a tuple of integers while BSDOIDStore
uses a packed binary string representation
Version 0.2.7
- Refactoring of Agent class to allow for easier construction of
mock objects that can simulate agent dialogues without needing to go
through the SNMP encoding/decoding stages
- Introduction of stand-alone errors module
- Use of errors module in OIDStore classes to indicate failed OID
lookup
Version 0.2.6
- Mostly just documentation changes to reflect new project location
URLs and the like.
Version 0.2.5
- Altered timeout methods to catch exceptions within themselves and
relay to the caller via the registered deferred object
- Documentation enhancements
- Patch to work around Python 2.3.x bug in the BSDDB wrapper class
- Eliminated old algorithms for MassRetriever
- Reduced default MassRetriever iteration delay to 0.005 instead of
0.01 seconds
Version 0.2.4
- Fixed bug with table request processing.
Version 0.2.3
- Rework of mass retriever algorithm (yet again) to be more robust
when dealing with larger AgentProxy sets
- Much simpler mechanism
- Throttles to initiate less than 200 queries/second by default,
but ignores the number in play, which, as it turns out, seems to be
somewhat useless for managing load. This is not ideal, as, at
least on our testing systems, the hardware can readily handle a few
thousand queries/second (it's Twisted's structure that requires the
throttling).
- Internal rework so that timeouts are cancelled ASAP for messages
received
- To prevent timeouts issuing before the system gets around to
calling the callback
- Discovered (as-yet-unfixed) bug in Agent's (as distinct from
AgentProxy) processing of table requests
- Basically it doesn't properly handle tables of different
lengths.
Version 0.2.2
- Bug-fix in utilities/mirroragent.py
- Test module cleanup for cross-platform operation
- Allow for operation when no bsddb module is available, as there
are platforms on which it's not available by default
- Use non-privileged port if the privileged 161 is not bindable
- Added check to twineTables for NULL OID set (passing in such an
OID set makes no sense, and would cause silent, difficult-to-track-down
errors)
Version 0.2.1
- Cleaned up and reworked mass-query mechanism;
- patterned loosely after the table-query mechanism
- fixed at least one logic bug in the batching machinery
- added adaptive heuristics for determining number of queries to
keep in play
- changes the api for retrieval in a backward-incompatible way
- Fixed shallow bug in TableRetriever's handling of responses with
unequal rootOID and (OID,value) set lengths
Version 0.2.0
- Complete refactoring of the client/manager-side API.
Instead of requiring one port per managed agent, is able to manage any
number of agents from a single port. Most of the machinery of the old
protocol object is now part of an AgentProxy class. You *will*
need to modify all client code to work with the new API. Mostly
just a matter of a different initialisation pattern and then using the
AgentProxy object in the same manner as you used the old SNMPProtocol
object.
- Crude mass-query mechanism created. As of yet only tested
against a local server, and doesn't yet have balancing heuristics to
throttle load in response to network response, but does appear to work.
- Dropped the snmpports module. It's no longer necessary with
the new structure.
- Bug was discovered in Python 2.3's BSDDB module which affects the
BSDDB storages, bug report submitted to the Python project, but for
now, will not pass tests under Python 2.3.
Version 0.1.5
- Refactored the test-suite into its own package w/ sub-modules for
the different test-types
- Fixed bug in usage of oidStore API for Agent set-requests
Version 0.1.4
- Utilities:
- mirroragent -- mirrors an agent to local bsddb shelve for
testing (still very rough, just a sketch, really)
- BSDOIDStore -- a new OIDStore implementation for use in utilities
- Major refactoring of the Agent-side mechanisms:
- AgentProtocol -- low-level send and dispatch of messages to the
Agent
- Agent -- SNMP logic for get/getNext/getTable/set implementation
- OIDStore -- interface for storage/retrieval of ordered OID tree
- BisectOIDStore -- the demo OIDStore implementation for testing
purposes using the bisect module
Version 0.1.3
- Agent and Manager-side set protocol implementation
- Minimal sample code for Agent-side set code, doesn't yet do the
error-negotiation stuff
Version 0.1.2
- Test code
- Agent-side protocol sample code extended to include getnext and
getbulk
Version 0.1.1
- Beginning of work on an Agent-side protocol and some sample Agent
code
Version 0.1