You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to get IF-MIB values via pysnmp, and am getting a No Such Object currently exists at this OID. I'm using code very similar to the example code, however, so I'm not sure what's going wrong. Can anyone see the issue? 1.3.6.1.2.1.2.2.1.6 is supposed to get the IF address (http://oid-info.com/get/1.3.6.1.2.1.2.2.1.6)
from pysnmp.hlapi import *
from pysnmp.smi import builder, view
# snmp.live.gambitcommunications.com
# demo.snmplabs.com
# snmpsim.try.thola.io
# localhost
MIB_VIEW_CONTROLLER = view.MibViewController(builder.MibBuilder())
g = getCmd(SnmpEngine(),
CommunityData('public'),
UdpTransportTarget(('127.0.0.1', 161)),
ContextData(),
ObjectType(ObjectIdentity('1.3.6.1.2.1.2.2.1.6')),
lookupNames=True, lookupValues=True)
errorIndication, errorStatus, errorIndex, varBinds = next(g)
if errorIndication:
print(errorIndication)
elif errorStatus:
print('%s at %s' % (errorStatus.prettyPrint(),
errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
else:
print("hello")
for varBind in varBinds:
print(type(varBind))
print(' = '.join([x.prettyPrint() for x in varBind]))
The text was updated successfully, but these errors were encountered:
If you read more about SNMP, you should know 1.3.6.1.2.1.2.2.1.6 is a column of the ifTable. Thus, the actual object must be queried via 1.3.6.1.2.1.2.2.1.6+<table index>, such as 1.3.6.1.2.1.2.2.1.6.1 (where the index is 1).
Or alternatively, you should use other methods to perform SNMP WALK operations. That's nextCmd/bulkCmd in old releases or walkCmd/bulkWalkCmd in the latest release.
I am trying to get IF-MIB values via pysnmp, and am getting a No Such Object currently exists at this OID. I'm using code very similar to the example code, however, so I'm not sure what's going wrong. Can anyone see the issue? 1.3.6.1.2.1.2.2.1.6 is supposed to get the IF address (http://oid-info.com/get/1.3.6.1.2.1.2.2.1.6)
The text was updated successfully, but these errors were encountered: