PySNMP Project Logo

Project diary
Documentation
Examples
Download
Mailing lists
License
Obsolete

Projects using PySNMP
NOC Project


Relevant projects
PyNetSNMP
SNMPy
YAPSNMP
LibSMI

Support This Project
SourceForge Logo

Asynchronous SNMP engine

The pysnmp.asynsnmp module defines the async_session class, which implements SNMP engine within Sam Rushing's asyncore framework. For more information on the asynchronous, non-blocking I/O techniques and their Python implementation, please, see Sam's tutorial.

The most important feature of asynchronous SNMP engine is that it can send and receive a number of SNMP requests virtually simultaneously, as well as handling some other, file descriptor based input/output activity at the same time. See examples/async_snmpget.py tool (supplied with PySNMP distribution) as an example of binding SNMP manager into Telnet server.

The async_session class subclasses the session class (which implements basic SNMP engine) so public attributes of session class become available to user of async_session class.

The pysnmp.async_session module itself defines the following items:

async_session(agent, community, callback_fun[, callback_data])

Returns a new instance of the async_session class, representing asynchronous SNMP engine suitable for sending SNMP messages to and receiving from SNMP process running on host agent, with SNMP community name.

The callback_fun and optional callback_data arguments are references to user function and execution context respectively.

The callback_fun function will be invoked by SNMP engine upon SNMP response arrival.

The following arguments will be passed along with the callback_fun(callback_data, encoded_oids, encoded_vals) function upon invocation:

  • callback_data holds a reference to user execution context as specified on class instance creation
  • encoded_oids a list of BER encoded SNMP Object IDs received with SNMP response
  • encoded_vals a list of BER encoded values associated with SNMP Object IDs encoded_oids. Object IDs and their respective values are matched by their positions in the lists.

Unsuccessful requests are indicated by empty entries in the encoded_oids and encoded_vals lists returned.

Instances of the async_session class can be reused for performing a number of SNMP requests to the same SNMP party.

  • Objects of the async_session class

Need help? Try PySNMP mailing lists.