Search code examples
snmpnet-snmp

How to get ifOperStatus from the SNMP MIB?


I was trying to get ifOperStatus with snmpget, but I found here that he does it like this

snmpwalk -Os -c public -v 1 192.168.1.1 1.3.6.1.2.1.2.2.1.8

So I tried that but I get no result

enter image description here

But the SNMP agent is working.

enter image description here

Can anyone tell me how can I access ifOperStatus?


Solution

  • Assuming your snmpwalk is the NET-SNMP version, then

    snmpwalk -Os -c public -v 1 192.168.1.1 .1.3.6.1.2.1.2.2.1.8

    should work (notice the extra dot in front of the OID). That makes it an absolute OID, rather than relative.