yapsnmp -- SNMP module

This module gives you high level access to the SNMP protocol, it requires the net-snmp libsnmp library.

The module is mostly used by instantiating the Session class, and calling it's methods, but a few additional functions are also available.

By peername, we mean anything that can be resolved by socket.gethostbyname() and by miboid, we refer to either the full numeric representation, or a string representation (either absolute or relative) of a MIBOID.

The module uses the Single Session API and is thus thread safe. All errors raise exceptions.

The module defines the following items:

Session(peername[, version[, community[, port]]])
This class represents a virtual connection to peername. version represents the version of SNMP to use, possible values are 1 for version 1 and 2 for version 2c. If ommited, the version defaults to 1. If you don't define community, it'll default to "public". The default remote port is set to 161, you most certainly want to set it to 162 for an instance your planning on using for traps.
set_flag(flag)
Will set the flag boolean to true. The list of available flags can be found below.
clear_flag(flag)
Will set the flag boolean to false.
define_flag(flag, state)
Will set the flag boolean to the value of state.
get_flag(flag)
Will return the current value of the flag boolean.
translate(miboid)
This function will translate the supplied miboid into a relative OID rooted at the MIB tree, or if in numeric OID output mode, into the numeric OID.
MIBParseError
Exception raised when a supplied miboid can't be resolved.
SendError
Exception raised when any form of send is executed and fails.
GetError
Exception raised when unable to obtain a response. Now a child of SendError.
VersionMismatch
Exception raised when an SNMP command not supported by the requested version is issued.
OIDTypeError
Exception raised when the miboid passed isn't of expected type.
PDUVarAddError
Exception raised when a variable can't be added to a PDU.
 
ALARM_DONT_USE_SIG
DONT_BREAKDOWN_OIDS
DONT_CHECK_RANGE
DONT_READ_CONFIGS
DUMP_PACKET
ESCAPE_QUOTES
EXTENDED_INDEX
LOG_TIMESTAMP
MIB_COMMENT_TERM
MIB_ERRORS
MIB_PARSE_LABEL
MIB_REPLACE
NO_TOKEN_WARNINGS
NUMERIC_TIMETICKS
PRINT_BARE_VALUE
PRINT_FULL_OID
PRINT_HEX_TEXT
PRINT_NUMERIC_ENUM
PRINT_NUMERIC_OIDS
QUICK_PRINT
RANDOM_ACCESS
REGEX_ACCESS
REVERSE_ENCODE
SAVE_MIB_DESCRS
These constants represent the available boolean flags to be used with the *_flag() functions.


Yves Perrenoud