Linux – snmpwalk doesn’t work with SNMP v3

linuxsnmp

We have a Cisco switch which we have been monitoring using Nagios over snmpv2 for ages. Recently our auditing team forced us to move to snmpv3 on all network devices.

The Cisco engineer came in and configured snmpv3 on the switches but after that snmpwalk stopped working:

When I try snmpwalk I the following error:

[root@nagios libexec]# snmpwalk -u snmprouser -A gs1snmmp -a MD5 -X DES -X gs1snmmp -l authPriv 192.168.13.11 -v3 
SNMPv2-SMI::mib-2 = No more variables left in this MIB View (It is past the end of the MIB tree)

The above credentials are right as it throws the following error when they are wrong:

[root@nagios libexec]# snmpwalk -u snmprouser -A gs11snmp -a MD5 -X DES -X gs1snmmp -l authPriv 192.168.13.11 -v3 
snmpwalk: Authentication failure (incorrect password, community or key)

When I try to get uptime:

[root@nagios libexec]# snmpwalk -u snmprouser -A gs1snmmp -a MD5 -X DES -X gs1snmmp -l authPriv 192.168.13.11 -v3 1.3.6.1.2.1.1.3.0
DISMAN-EVENT-MIB::sysUpTimeInstance = No more variables left in this MIB View (It is past the end of the MIB tree)

Also:

[root@nagios ~]# snmpwalk -v3 -u snmprouser -A gs1snmmp -a MD5 -X DES -X gs1snmmp -l authPriv 192.168.13.11 mib-2.interfaces
IF-MIB::interfaces = No more variables left in this MIB View (It is past the end of the MIB tree)

Best Answer

Some code I wrote using Linux and Ruby:

def snmp_cmd(cmd)
    `#{cmd} -Oq -v3 -u #{@user} -l authpriv -a MD5 \
    -A #{@auth} -x DES -X #{@priv} #{@name} #{@oid}`
end

Running it against a Linux host with an oid of '1' yields the entire mib. Not sure why you want to do this because it takes a long time to complete. Your problem may be 'Cisco-centric' as this snippet also works for me on HP switches and Windows hosts (not the oid=1 part).

You might want to narrow your query to a specific item.