The following example scripts are based on various services provided
by the PySNMP framework. The most of these tools try to behave as their
UCD SNMP conterparts
whenever possible.
-
The snmpget.py script uses SNMP v.1/v.2c GET
request to retrieve one or more SNMP objects (SNMP Object IDs and their
associated values) from a SNMP agent.
-
The snmpset.py script uses SNMP v.1/v.2c SET
request to send one or more SNMP objects to a SNMP agent.
-
The snmpwalk.py script uses SNMP v.1/v.2c GETNEXT
request to iteratively retrieve one or more lexicographically larger SNMP objects
from an SNMP agent.
-
The snmpbulk.py script uses SNMP v.1/v.2c GET request
to retrieve one or more SNMP objects from multiple SNMP agents at once.
This tool is to demonstrate the use of pysnmp.bulkrole
module which is designed to poll large number of SNMP agents at the
same time (collecting accounting data from many routers at a specific moment,
for example).
-
The snmpbulkwalk.py script uses
SNMP v.2c GETBULK request to retrieve a large number of SNMP
objects (possibly SNMP table) from an SNMP agent.
-
The asyncmgr.py script implements
a simple Telnet like server that interacts with user via command line.
User instructs server to poll arbitrary SNMP agent and report back to
user when SNMP reply is received. Server may poll a number of SNMP
agents in the same time as well as handle a number of Telnet sessions
simultaneously.
This script demonstrates the use of pysnmp.asynrole module
designed to ease the binding of SNMP engine with a Python application
built around asynchronous I/O engine
(asyncore module).
-
The snmpagent.py script acts as a
SNMP agent (server). It waits for SNMP messages (of any type and protocol version)
to come from a network and prints the details of received messages on stdout.
-
The snmptrap.py script acts as a SNMP trap
agent. It uses SNMP TRAP request (either of v.1 or v.2c) to send SNMP
trap message to a SNMP manager.
According to SNMP trap specification
(RFC 1157,
RFC 1905),
SNMP manager is not expected to respond anything back to SNMP
agent process upon trap message receiption.
-
The snmptrapd.py script acts as a
SNMP manager (trap server). It waits for SNMP trap messages (of either
v.1 or v.2c) to come from a network and prints the details of received
messages on stdout.
The above scripts are taken from PySNNP package. For more example tools,
please, refer to examples/ directory of PySNMP distribution.