Python SNMP simple example to get 1 OID

Because it took me forever to piece this simple code together

import netsnmp
session = netsnmp.Session( DestHost='your.host.com', Version=2, Community='public' )
vars = netsnmp.VarList( netsnmp.Varbind('.1.3.6.1.4.1.2021.8.1.101.1') )
print( session.get(vars) )

One Reply to “Python SNMP simple example to get 1 OID”

Leave a Reply

Your email address will not be published. Required fields are marked *