#!/usr/local/bin/python -O """ Retrieve a SNMP table of Object IDs starting from user specifed SNMP Object ID(s) from arbitrary SNMP agent using SNMP v.2 GETBULK PDU. Since MIB parser is not yet implemented in Python, this script takes and reports Object IDs in dotted numeric representation only. Written by Ilya Etingof , 2000-2002 """ import sys import getopt # Import PySNMP modules from pysnmp import asn1, v2c from pysnmp import role # Initialize help messages options = 'Options:\n' options = options + ' -p port to communicate with at the agent. Default is 161.\n' options = options + ' -r number of retries to be used in requests. Default is 5.\n' options = options + ' -t timeout between retries. Default is 1.\n' usage = 'Usage: %s [options] ' + str(val) # BER encode next SNMP Object IDs to query encoded_oids = map(asn1.OBJECTID().encode, oids[-1:]) # Update request object req['request_id'] = req['request_id'] + 1