Here are examples of commands used to retrieve information from network elements with SNMP agents including the snmpbulkget and snmpbulkwalk commands introduced in SNMPv3.
snmpget
The following command retrieves the variable system.sysDescr.0 from the host cecil using the community string public:
snmpget -c public cecil system.sysDescr.0
snmpwalk
The following command retrieves all the variables under system:
snmpwalk -Os -c public -v 1 cecil system
sysDescr.0 = STRING: NetApp Release RironcityN_080806_2230: Wed Aug 6 23:55:19 PDT 2008 sysObjectID.0 = OID: enterprises.789.2.3 sysUpTimeInstance = Timeticks: (121596665) 14 days, 1:46:06.65 sysContact.0 = STRING: sysName.0 = STRING: cecil.lab.netapp.com sysLocation.0 = STRING: sysServices.0 = INTEGER: 72 #
The following command is an example of an SNMP request from an IPv6 client:
snmpwalk -v2c -c public udp6:[2001:0db8:85a3:0:0:8a2e:0370:99]:161 system
SNMPv2-MIB::sysDescr.0 = STRING: Data ONTAP Release RironcityN_080820_2230: Fri Aug 22 05:39:37 IST 2008 SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.789.2.3 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (11415057) 1 day,7:42:30.57 SNMPv2-MIB::sysContact.0 = STRING: SNMPv2-MIB::sysName.0 = STRING:n3700-183-85.lab.eng.btc.netapp.in SNMPv2-MIB::sysLocation.0 = STRING: SNMPv2-MIB::sysServices.0 = INTEGER: 72
snmpbulkget
The following command retrieves the variable system sysDescr.0 and the first three objects in the ifTable:
snmpbulkget -v2c -Cn1 -Cr3 -Os -c public cecil system ifTable
sysDescr.0 = STRING: NetApp Release RironcityN_080806_2230: Wed Aug 6 23:55:19 PDT 2008 ifIndex.1 = INTEGER: 1 ifIndex.2 = INTEGER: 2 ifDescr.1 = STRING: "lo0"
snmpbulkwalk
The following command retrieves all the variables under system:
snmpbulkwalk -v2c -Os -c public cecil system
sysDescr.0 = STRING: NetApp Release RironcityN_080806_2230: Wed Aug 6 23:55:19 PDT 2008 sysObjectID.0 = OID: enterprises.789.2.3 sysUpTimeInstance = Timeticks: (121603434) 14 days, 1:47:14.34 sysContact.0 = STRING: sysName.0 = STRING: cecil.lab.netapp.com sysLocation.0 = STRING: sysServices.0 = INTEGER: 72
SNMPv3 snmpwalk
An SNMPv3 request using the snmpwalk command retrieves all of the variables under system:
snmpwalk -v 3 -u joeblow -l authNoPriv -A joeblow12 cecil system
SNMPv2-MIB::sysDescr.0 = STRING: NetApp Release RironcityN_080806_2230: Wed Aug 6 23:55:19 PDT 2008 SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.789.2.3 DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (121622059) 14 days, 1:50:20.59 SNMPv2-MIB::sysContact.0 = STRING: SNMPv2-MIB::sysName.0 = STRING: cecil.lab.netapp.com SNMPv2-MIB::sysLocation.0 = STRING: SNMPv2-MIB::sysServices.0 = INTEGER: 72 #