Table of Contents

How to use snmpwalk command in Linux



snmpwalk Options

# snmpwalk -h

USAGE: snmpwalk [OPTIONS] AGENT [OID]

OPTIONS:
  -h, --help            display this help message
  -v 1|2c|3             specifies SNMP version to use

SNMP Version 1 or 2c specific
  -c COMMUNITY          set the community string

General options
  -O OUTOPTS            Toggle various defaults controlling output display:
                          n:  print OIDs numerically


RFC1213 MIB-II (1.3.6.1.2.1)
NET-SNMP MIB(1.3.6.1.4.1.2021)


System Information

hostname (sysname=OID .1.3.6.1.2.1.1.5)

# snmpwalk -v 2c -c public 127.0.0.1 sysname
SNMPv2-MIB::sysName.0 = STRING: localhost.localdomain

# snmpwalk -v 2c -c public 127.0.0.1 .1.3.6.1.2.1.1.5
SNMPv2-MIB::sysName.0 = STRING: localhost.localdomain

# snmpwalk -v 2c -c public -O n 127.0.0.1 sysname
.1.3.6.1.2.1.1.5.0 = STRING: centos7
# 

uname -a (sysDescr = OID .1.3.6.1.2.1.1.1)

hostname, kernel

# snmpwalk -v 2c -c public 127.0.0.1 .1.3.6.1.2.1.1.1
SNMPv2-MIB::sysDescr.0 = STRING: Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64

# snmpwalk -v 2c -c public localhost sysDescr
SNMPv2-MIB::sysDescr.0 = STRING: Linux centos7 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64


Network Interface Information # 32bit counter (OID .1.3.6.1.2.1.2)

ifIndex = OID .1.3.6.1.2.1.2.2.1.1

# snmpwalk -v 2c 127.0.0.1 -c public .1.3.6.1.2.1.2.2.1.1
IF-MIB::ifIndex.1 = INTEGER: 1
IF-MIB::ifIndex.2 = INTEGER: 2
IF-MIB::ifIndex.3 = INTEGER: 3
IF-MIB::ifIndex.4 = INTEGER: 4

ifDesc = OID .1.3.6.1.2.1.2.2.1.2

# snmpwalk -v 2c 127.0.0.1 -c public .1.3.6.1.2.1.2.2.1.2
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: eth0

# snmpwalk -v 2c 127.0.0.1 -c public .1.3.6.1.2.1.2.2.1.2
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: enp0s3
IF-MIB::ifDescr.3 = STRING: br-295e2a4e2c26
IF-MIB::ifDescr.4 = STRING: docker0

ifSpeed = OID .1.3.6.1.2.1.2.2.1.5

1000000000 bps = 1,000,000,000 bps = 1Gbps

# snmpwalk -v 2c 127.0.0.1 -c public .1.3.6.1.2.1.2.2.1.5
IF-MIB::ifSpeed.1 = Gauge32: 10000000
IF-MIB::ifSpeed.2 = Gauge32: 1000000000
IF-MIB::ifSpeed.3 = Gauge32: 0
IF-MIB::ifSpeed.4 = Gauge32: 0

ifPhysAddress = OID .1.3.6.1.2.1.2.2.1.6

# snmpwalk -v 2c 127.0.0.1 -c public .1.3.6.1.2.1.2.2.1.6
IF-MIB::ifPhysAddress.1 = STRING:
IF-MIB::ifPhysAddress.2 = STRING: 8:0:27:15:77:7d
IF-MIB::ifPhysAddress.3 = STRING: 2:42:9b:e0:a6:dc
IF-MIB::ifPhysAddress.4 = STRING: 2:42:b1:9:fa:1f

ifOperStatus = OID .1.3.6.1.2.1.2.2.1.8

# snmpwalk -v 2c 127.0.0.1 -c public .1.3.6.1.2.1.2.2.1.8
IF-MIB::ifOperStatus.1 = INTEGER: up(1)
IF-MIB::ifOperStatus.2 = INTEGER: up(1)
IF-MIB::ifOperStatus.3 = INTEGER: down(2)
IF-MIB::ifOperStatus.4 = INTEGER: down(2)


Network Interface Information # 64bit counter (OID .1.3.6.1.2.1.31.1.1.1)

ifName = OID .1.3.6.1.2.1.31.1.1.1.1

# snmpwalk -v 2c -c public 127.0.0.1  .1.3.6.1.2.1.31.1.1.1.1
IF-MIB::ifName.1 = STRING: lo
IF-MIB::ifName.2 = STRING: enp0s3
IF-MIB::ifName.3 = STRING: br-295e2a4e2c26
IF-MIB::ifName.4 = STRING: docker0

# snmpwalk -v 2c -c public 127.0.0.1  ifname
IF-MIB::ifName.1 = STRING: lo
IF-MIB::ifName.2 = STRING: enp0s3
IF-MIB::ifName.3 = STRING: br-295e2a4e2c26
IF-MIB::ifName.4 = STRING: docker0

ifHighSpeed = OID .1.3.6.1.2.1.31.1.1.1.15

1000 Mbps= 1Gbps

$ snmpwalk -v 2c -c public 127.0.0.1  .1.3.6.1.2.1.31.1.1.1.15
IF-MIB::ifHighSpeed.1 = Gauge32: 10
IF-MIB::ifHighSpeed.2 = Gauge32: 1000
IF-MIB::ifHighSpeed.3 = Gauge32: 0
IF-MIB::ifHighSpeed.4 = Gauge32: 0

$ snmpwalk -v 2c -c public 127.0.0.1  ifhighspeed
IF-MIB::ifHighSpeed.1 = Gauge32: 10
IF-MIB::ifHighSpeed.2 = Gauge32: 1000
IF-MIB::ifHighSpeed.3 = Gauge32: 0
IF-MIB::ifHighSpeed.4 = Gauge32: 0


IP Address

ipAdEntAddr = OID .1.3.6.1.2.1.4.20.1.1

$ snmpwalk -v 2c -c public 127.0.0.1  .1.3.6.1.2.1.4.20.1.1
IP-MIB::ipAdEntAddr.127.0.0.1 = IpAddress: 127.0.0.1
IP-MIB::ipAdEntAddr.172.17.0.1 = IpAddress: 172.17.0.1
IP-MIB::ipAdEntAddr.192.168.0.22 = IpAddress: 192.168.0.22
IP-MIB::ipAdEntAddr.192.168.10.1 = IpAddress: 192.168.10.1

ipAdEntNetMask = OID .1.3.6.1.2.1.4.20.1.3

$ snmpwalk -v 2c -c public 127.0.0.1  .1.3.6.1.2.1.4.20.1.3
IP-MIB::ipAdEntNetMask.127.0.0.1 = IpAddress: 255.0.0.0
IP-MIB::ipAdEntNetMask.172.17.0.1 = IpAddress: 255.255.0.0
IP-MIB::ipAdEntNetMask.192.168.0.22 = IpAddress: 255.255.255.0
IP-MIB::ipAdEntNetMask.192.168.10.1 = IpAddress: 255.255.255.0


CPU

Cpu Type

$ snmpwalk -v 2c -c public 127.0.0.1  .1.3.6.1.2.1.25.3.2.1.3 |grep -i cpu
HOST-RESOURCES-MIB::hrDeviceDescr.196608 = STRING: GenuineIntel: Intel(R) Core(TM) i7-6700T CPU @ 2.80GHz
HOST-RESOURCES-MIB::hrDeviceDescr.196609 = STRING: GenuineIntel: Intel(R) Core(TM) i7-6700T CPU @ 2.80GHz

hrProcessorLoad = OID .1.3.6.1.2.1.25.3.3.1.2

$ snmpwalk -v 2c -c public 127.0.0.1 .1.3.6.1.2.1.25.3.3.1.2
HOST-RESOURCES-MIB::hrProcessorLoad.196608 = INTEGER: 1
HOST-RESOURCES-MIB::hrProcessorLoad.196609 = INTEGER: 1

Load Average = OID .1.3.6.1.4.1.2021.10.1

$ snmpwalk -v 2c -c public 127.0.0.1 .1.3.6.1.4.1.2021.10.1
UCD-SNMP-MIB::laIndex.1 = INTEGER: 1
UCD-SNMP-MIB::laIndex.2 = INTEGER: 2
UCD-SNMP-MIB::laIndex.3 = INTEGER: 3
UCD-SNMP-MIB::laNames.1 = STRING: Load-1
UCD-SNMP-MIB::laNames.2 = STRING: Load-5
UCD-SNMP-MIB::laNames.3 = STRING: Load-15
UCD-SNMP-MIB::laLoad.1 = STRING: 0.05
UCD-SNMP-MIB::laLoad.2 = STRING: 0.03
UCD-SNMP-MIB::laLoad.3 = STRING: 0.05
UCD-SNMP-MIB::laConfig.1 = STRING: 12.00
UCD-SNMP-MIB::laConfig.2 = STRING: 12.00
UCD-SNMP-MIB::laConfig.3 = STRING: 12.00
UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 5
UCD-SNMP-MIB::laLoadInt.2 = INTEGER: 3
UCD-SNMP-MIB::laLoadInt.3 = INTEGER: 5
UCD-SNMP-MIB::laLoadFloat.1 = Opaque: Float: 0.050000
UCD-SNMP-MIB::laLoadFloat.2 = Opaque: Float: 0.030000
UCD-SNMP-MIB::laLoadFloat.3 = Opaque: Float: 0.050000
UCD-SNMP-MIB::laErrorFlag.1 = INTEGER: noError(0)
UCD-SNMP-MIB::laErrorFlag.2 = INTEGER: noError(0)
UCD-SNMP-MIB::laErrorFlag.3 = INTEGER: noError(0)
UCD-SNMP-MIB::laErrMessage.1 = STRING:
UCD-SNMP-MIB::laErrMessage.2 = STRING:
UCD-SNMP-MIB::laErrMessage.3 = STRING:


Memory (OID .1.3.6.1.4.1.2021.4)

# snmpwalk -v 2c localhost -c public .1.3.6.1.4.1.2021.4
UCD-SNMP-MIB::memIndex.0 = INTEGER: 0
UCD-SNMP-MIB::memErrorName.0 = STRING: swap
UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 1015800 kB
UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 1015800 kB
UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 502220 kB
UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 336160 kB
UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 1351960 kB
UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000 kB
UCD-SNMP-MIB::memBuffer.0 = INTEGER: 8328 kB
UCD-SNMP-MIB::memCached.0 = INTEGER: 56128 kB
UCD-SNMP-MIB::memSwapError.0 = INTEGER: noError(0)
UCD-SNMP-MIB::memSwapErrorMsg.0 = STRING:


$ snmpwalk -v 2c 127.0.0.1 -c public memory
UCD-SNMP-MIB::memIndex.0 = INTEGER: 0
UCD-SNMP-MIB::memErrorName.0 = STRING: swap
UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 839676 kB
UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 839676 kB
UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 757968 kB
UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 206904 kB
UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 1046580 kB
UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000 kB
UCD-SNMP-MIB::memShared.0 = INTEGER: 6176 kB
UCD-SNMP-MIB::memBuffer.0 = INTEGER: 4204 kB
UCD-SNMP-MIB::memCached.0 = INTEGER: 246068 kB
UCD-SNMP-MIB::memSwapError.0 = INTEGER: noError(0)
UCD-SNMP-MIB::memSwapErrorMsg.0 = STRING:


Disk Infomation