Easy API

easysnmp.snmp_get(oids, **session_kargs)

Perform an SNMP GET operation to retrieve a particular piece of information.

Parameters:
  • oids – you may pass in a list of OIDs or single item; each item may be a string representing the entire OID (e.g. ‘sysDescr.0’) or may be a tuple containing the name as its first item and index as its second (e.g. (‘sysDescr’, 0))
  • session_kargs – keyword arguments which will be sent used when constructing the session for this operation; all parameters in the Session class are supported
easysnmp.snmp_set(oid, value, type=None, **session_kargs)

Perform an SNMP SET operation to update a particular piece of information.

Parameters:
  • oid – the OID that you wish to set which may be a string representing the entire OID (e.g. ‘sysDescr.0’) or may be a tuple containing the name as its first item and index as its second (e.g. (‘sysDescr’, 0))
  • value – the value to set the OID to
  • snmp_type – if a numeric OID is used and the object is not in the parsed MIB, a type must be explicitly supplied
  • session_kargs – keyword arguments which will be sent used when constructing the session for this operation; all parameters in the Session class are supported
easysnmp.snmp_set_multiple(oid_values, **session_kargs)

Perform multiple SNMP SET operations to update various pieces of information at the same time.

Parameters:
  • oid_values – a list of tuples whereby each tuple contains a (oid, value) or an (oid, value, snmp_type)
  • session_kargs – keyword arguments which will be sent used when constructing the session for this operation; all parameters in the Session class are supported
easysnmp.snmp_get_next(oids, **session_kargs)

Uses an SNMP GETNEXT operation to retrieve the next variable after the chosen item.

Parameters:
  • oids – you may pass in a list of OIDs or single item; each item may be a string representing the entire OID (e.g. ‘sysDescr.0’) or may be a tuple containing the name as its first item and index as its second (e.g. (‘sysDescr’, 0))
  • session_kargs – keyword arguments which will be sent used when constructing the session for this operation; all parameters in the Session class are supported
easysnmp.snmp_get_bulk(oids, non_repeaters=0, max_repetitions=10, **session_kargs)

Performs a bulk SNMP GET operation to retrieve multiple pieces of information in a single packet.

Parameters:
  • oids – you may pass in a list of OIDs or single item; each item may be a string representing the entire OID (e.g. ‘sysDescr.0’) or may be a tuple containing the name as its first item and index as its second (e.g. (‘sysDescr’, 0))
  • non_repeaters – the number of objects that are only expected to return a single GETNEXT instance, not multiple instances
  • max_repetitions – the number of objects that should be returned for all the repeating OIDs
  • session_kargs – keyword arguments which will be sent used when constructing the session for this operation; all parameters in the Session class are supported
easysnmp.snmp_walk(oids='.1.3.6.1.2.1', **session_kargs)

Uses SNMP GETNEXT operation to automatically retrieve multiple pieces of information in an OID for you.

Parameters:
  • oids – you may pass in a single item (multiple values currently experimental) which may be a string representing the entire OID (e.g. ‘sysDescr.0’) or may be a tuple containing the name as its first item and index as its second (e.g. (‘sysDescr’, 0))
  • session_kargs – keyword arguments which will be sent used when constructing the session for this operation; all parameters in the Session class are supported
easysnmp.snmp_bulkwalk(oids='.1.3.6.1.2.1', non_repeaters=0, max_repetitions=10, **session_kargs)

Uses SNMP GETBULK operation using the prepared session to automatically retrieve multiple pieces of information in an OID

Parameters:
  • oids – you may pass in a single item * string representing the entire OID (e.g. ‘sysDescr.0’) * tuple (name, index) (e.g. (‘sysDescr’, 0)) * list of OIDs
  • non_repeaters – the number of objects that are only expected to return a single GETNEXT instance, not multiple instances
  • max_repetitions – the number of objects that should be returned for all the repeating OIDs
Returns:

a list of SNMPVariable objects containing the values that were retrieved via SNMP