1. dnf install net-snmp-devel
  2. pip install easysnmp

from easysnmp import Session

Create an SNMP session to be used for all our requests

session = Session(hostname=’demo.snmplabs.com’, community=’public’, version=2)

You may retrieve an individual OID using an SNMP GET

location = session.get(‘sysLocation.0’)

You may also specify the OID as a tuple (name, index)

Note: the index is specified as a string as it can be of other types than

just a regular integer

contact = session.get((‘sysContact’, ‘0’))

And of course, you may use the numeric OID too

description = session.get(‘.’)

Set a variable using an SNMP SET

session.set(‘sysLocation.0’, ‘The SNMP Lab’)

Perform an SNMP walk

system_items = session.walk(‘system’)

Each returned item can be used normally as its related type (str or int)

but also has several extended attributes with SNMP-specific information

for item in system_items:
print ‘{oid}.{oid_index} {snmp_type} = {value}’.format(