How do I run an SNMP Walk from the command line?
To run an SNMP walk via the command line you can use the nim-snmpwalk tool.
e.g. to see the help:
statseeker$ nim-snmpwalk -h
nim-snmpwalk [-rtgfov] ...
Options:
-r <number of retry attempts>
-e Passwords are encrypted
-t <request timeout>
-g <gentle mode factor>
-f <path to input file>
-o <prefix path to output files>
-v <verbose level 0 to 3>
Input Format:
<ip> (port <portnum>) 1 <community> <varbinds>
<ip> (port <portnum>) 2 <community> <varbinds>
<ip> (port <portnum>) 3 (noauth|user <username>) nopriv (nocontext|context <name>) <varbinds>
<ip> (port <portnum>) 3 auth (md5|sha|sha224|sha256|sha384|sha512) <username> <password> (nopriv|priv (des|des3|aes|aes192|aes256) <password>) (nocontext|context <name>) <varbinds>
The "varbinds" parameter is basically the OID you wish to start from, which in most cases will be 1, the first OID.
In most cases please use the v3 (verbosity level 3) option as this will give the same output format as the GUI.
Examples:
For an SNMP V2 device with verbosity level 3 and an output file called snmpwalkfile.<ip_address>
nim-snmpwalk -v3 -o snmpwalkfile. 10.100.83.253 2 public 1
For an SNMP V3 device device with:
Verbosity level 3
An output file called snmpwalkfile.<ip_address>
Authentication: SHA
Username: sha3des168
Password: sha3des168
Privacy: 3DES
Password: sha3des168
nim-snmpwalk -v3 -o snmpwalkfile. 10.1.13.50 3 auth sha sha3des168 sha3des168 priv 3des sha3des168 nocontext org
The output file will be appended with the device IP Address and with the v3 verbostiy option will have the same format as per the Statseeker GUI.
e.g.
statseeker$ ls -la snmpwalkfile.10.100.83.253
-rw-r--r-- 1 statseeker statseeker 274766 Apr 28 16:27 snmpwalkfile.10.100.83.253
statseeker$ head snmpwalkfile.10.100.83.253
1745821621 10.100.83.253 2 public 1.3.6.1.2.1.1.1.0 SNMPv2-MIB.sysDescr.0 OCTET-STRING Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(46)SE, RELEASE SOFTWARE (fc2) Copyright (c) 1986-2008 by Cisco Systems, Inc. Compiled Thu 21-Aug-08 15:59 by nachen
1745821621 10.100.83.253 2 public 1.3.6.1.2.1.1.2.0 SNMPv2-MIB.sysObjectID.0 OBJECT-IDENTIFIER CISCO-PRODUCTS-MIB.catalyst2960G8TC
1745821621 10.100.83.253 2 public 1.3.6.1.2.1.1.3.0 SNMPv2-MIB.sysUpTime.0 TimeTicks 54619262 6d07h43m12s
1745821621 10.100.83.253 2 public 1.3.6.1.2.1.1.4.0 SNMPv2-MIB.sysContact.0 OCTET-STRING Kolkata-support@example.com
1745821621 10.100.83.253 2 public 1.3.6.1.2.1.1.5.0 SNMPv2-MIB.sysName.0 OCTET-STRING Kolkata-swt1.example.com
1745821621 10.100.83.253 2 public 1.3.6.1.2.1.1.6.0 SNMPv2-MIB.sysLocation.0 OCTET-STRING Kolkata
1745821621 10.100.83.253 2 public 1.3.6.1.2.1.1.7.0 SNMPv2-MIB.sysServices.0 Integer32 2
1745821621 10.100.83.253 2 public 1.3.6.1.2.1.2.2.1.1.10101 IF-MIB.ifIndex.10101 Integer32 10101
1745821621 10.100.83.253 2 public 1.3.6.1.2.1.2.2.1.1.10102 IF-MIB.ifIndex.10102 Integer32 10102
1745821621 10.100.83.253 2 public 1.3.6.1.2.1.2.2.1.1.10103 IF-MIB.ifIndex.10103 Integer32 10103