This artical will recording some commonly used OIDs, like memory usege,interface counters.
写在最前面
对于OID着类查询,其实没有什么很好的方法,最主要的就是多Google一下,多尝试用工具get几个值看一下.请搜索snmpwalk这个小工具,windows和linux版本都有.Linux如何安装参考如下:
1
[root@localhost ~]# yum install net-snmp-utils你可能需要的几个网址:
- 查OID意思的网址
http://cric.grenoble.cnrs.fr/Administrateurs/Outils/MIBS/?oid=1.3.6.1.2.1.138.1.10.1.1
http://snmp.cloudapps.cisco.com/Support/SNMP/do/BrowseOID.do?local=en <<< CISCO 官方的网址
- 有关cisco产品所支持的MIB库.
ftp://ftp.cisco.com/pub/mibs/supportlists/
1
#show snmp mib object-name | inc <oid> <<查看某个oid在9k上是否支持接口相关的OID
1
ifAdminStatus 1.3.6.1.2.1.2.2.1.7 <<<<< 端口管理状态 up/down2
ifOperStatus 1.3.6.1.2.1.2.2.1.8 <<<< 端口运行状态 up/down3
MAC 1.3.6.1.2.1.2.2.1.6 <<<< 端口mac地址 4
ifInOctets 1.3.6.1.2.1.2.2.1.10 <<<<端口如方向流量字节总数5
ifOutOctets 1.3.6.1.2.1.2.2.1.16 <<<<端口出方向字节总数6
ifSpeed 1.3.6.1.2.1.2.2.1.5 <<<<端口带宽7
ifDescr 1.3.6.1.2.1.2.2.1.2 <<<<端口名称8
ifxAlias 1.3.6.1.2.1.31.1.1.1.18 <<<<端口别名/即端口descriptionSHOW INTERFACE下的LAST LINK FLAP时间
1
RP/0/RP0/CPU0:CORE6-ASR9922-A#show int hundredGigE 0/0/0/6 | in flapped2
Tue Nov 27 21:07:00.288 UTC3
Last link flapped 01:07:404
5
We need following OID6
7
1.3.6.1.2.1.2.2.1.2 ifDescr <<< get interface name and ifindex8
1.3.6.1.2.1.2.2.1.9 ifLastChange <<< get the time of sysUpTime when interface state change9
1.3.6.1.2.1.1.3.0 sysUpTimeInstance <<< get sysUpTime10
11
So Last link flapped time should be ( sysUpTimeInstance – ifLastChange )12
13
For example:14
15
[root@xuxing ~]# snmpwalk -v 2c -c cisco 10.75.49.13 1.3.6.1.2.1.2.2.1.2 | grep 0/0/0/616
IF-MIB::ifDescr.104 = STRING: HundredGigE0/0/0/617
[root@xuxing ~]# snmpwalk -v 2c -c cisco 10.75.49.13 1.3.6.1.2.1.2.2.1.9.10418
IF-MIB::ifLastChange.104 = Timeticks: (9460) 0:01:34.60 <<<19
[root@xuxing ~]# snmpwalk -v 2c -c cisco 10.75.49.13 1.3.6.1.2.1.1.3.020
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (419819) 1:09:58.19 <<<21
22
1:09:58:19 - 0:01:34:60 = 1:08:24:00 same as above outputSHOW INTERFACE下的CRC计数
1
RP/0/RSP0/CPU0:ASR9006-F# show int tenGigE 1/0/0/1 | in CRC2
Tue Dec 18 18:55:53.560 UTC3
559851 input errors, 55 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort4
RP/0/RSP0/CPU0:ASR9006-F#5
6
we need following OID7
8
1.3.6.1.2.1.2.2.1.2 ifDescr9
1.3.6.1.2.1.10.7.11.1.2 dot3HCStatsFCSErrors10
11
[root@xuxing ~]# snmpwalk -v 2c -c cisco 10.75.49.35 1.3.6.1.2.1.2.2.1.2 | grep TenGigE1/0/0/1 <<< get ifindex and ifname12
IF-MIB::ifDescr.375 = STRING: TenGigE1/0/0/113
[root@xuxing ~]# snmpwalk -v 2c -c cisco 10.75.49.35 1.3.6.1.2.1.10.7.11.1.2.375 <<<get CRC counter14
EtherLike-MIB::dot3HCStatsFCSErrors.375 = Counter64: 55监控板卡的MEMORY使用情况
1
*if the LC memeory smaller than 4G,you can use below OID to check the memeory usage *2
ciscoMemoryPoolUsed: 1.3.6.1.4.1.9.9.48.1.1.1.53
ciscoMemoryPoolFree: 1.3.6.1.4.1.9.9.48.1.1.1.64
*if the LC memeory bigger than 4G, use below OID*5
cempMemPoolHCUsed: 1.3.6.1.4.1.9.9.221.1.1.1.1.18 <<< memory LC used 6
cempMemPoolHCFree: 1.3.6.1.4.1.9.9.221.1.1.1.1.20 <<< memory free7
For example:8
1. Get the memory used.9
[root@localhost ~]# snmpwalk -v 2c -c cisco 10.75.49.54 1.3.6.1.4.1.9.9.221.1.1.1.1.1810
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.18.18788073.1 = Counter64: 283632232811
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.18.18788073.2 = Counter64: 13421772812
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.18.18788073.3 = Counter64: 7415830413
14
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.18.52690955.1 = Counter64: 216761462415
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.18.52690955.2 = Counter64: 13421772816
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.18.52690955.3 = Counter64: 7382946417
18
2. Get the memory free.19
20
[root@localhost ~]# snmpwalk -v 2c -c cisco 10.75.49.54 1.3.6.1.4.1.9.9.221.1.1.1.1.2021
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.20.18788073.1 = Counter64: 554493542422
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.20.18788073.2 = Counter64: 023
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.20.18788073.3 = Counter64: 024
25
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.20.52690955.1 = Counter64: 621397196826
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.20.52690955.2 = Counter64: 027
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.20.52690955.3 = Counter64: 028
29
3. Get the LC type.30
31
[root@localhost ~]# snmpwalk -v 2c -c cisco 10.75.49.54 1.3.6.1.2.1.47.1.1.1.1.7 | grep 1878807332
SNMPv2-SMI::mib-2.47.1.1.1.1.7.18788073 = STRING: "module 0/0/CPU0"33
[root@localhost ~]# 34
[root@localhost ~]# 35
[root@localhost ~]# snmpwalk -v 2c -c cisco 10.75.49.54 1.3.6.1.2.1.47.1.1.1.1.7 | grep 5269095536
SNMPv2-SMI::mib-2.47.1.1.1.1.7.52690955 = STRING: "module 0/RSP0/CPU0"37
[root@localhost ~]#38
39
RP/0/RSP0/CPU0:ASR9001-B#show memory summary location all 40
Thu Apr 4 05:28:16.085 UTC41
42
node: node0_0_CPU043
------------------------------------------------------------------44
Physical Memory: 8192M total45
Application Memory : 7992M (5288M available)46
Image: 70M (bootram: 70M)47
Reserved: 128M, IOMem: 0, flashfsys: 048
Total shared window: 128M49
50
node: node0_RSP0_CPU051
------------------------------------------------------------------52
Physical Memory: 8192M total (5923M available)53
Application Memory : 7993M (5923M available)54
Image: 70M (bootram: 70M)55
Reserved: 128M, IOMem: 0, flashfsys: 056
Total shared window: 41M监控板卡的CPU利用率
1
>1.3.6.1.4.1.9.9.109.1.1.1.1.7 cpmCPUTotal1minRev <<<1min2
>1.3.6.1.4.1.9.9.109.1.1.1.1.8 cpmCPUTotal5minRev <<<5min3
4
5
[root@localhost ~]# snmpwalk -v 2c -c cisco 10.75.39.20 1.3.6.1.4.1.9.9.109.1.1.1.16
SNMPv2-SMI::enterprises.9.9.109.1.1.1.1.2.2 = INTEGER: 52690955 <<< this is card type7
SNMPv2-SMI::enterprises.9.9.109.1.1.1.1.2.18 = INTEGER: 269321928
SNMPv2-SMI::enterprises.9.9.109.1.1.1.1.2.2082 = INTEGER: 187880739
SNMPv2-SMI::enterprises.9.9.109.1.1.1.1.2.2098 = INTEGER: 869577210
SNMPv2-SMI::enterprises.9.9.109.1.1.1.1.7.2 = Gauge32: 2 <<<<11
SNMPv2-SMI::enterprises.9.9.109.1.1.1.1.7.18 = Gauge32: 112
SNMPv2-SMI::enterprises.9.9.109.1.1.1.1.7.2082 = Gauge32: 2 13
SNMPv2-SMI::enterprises.9.9.109.1.1.1.1.7.2098 = Gauge32: 414
SNMPv2-SMI::enterprises.9.9.109.1.1.1.1.8.2 = Gauge32: 2 <<<<15
SNMPv2-SMI::enterprises.9.9.109.1.1.1.1.8.18 = Gauge32: 116
SNMPv2-SMI::enterprises.9.9.109.1.1.1.1.8.2082 = Gauge32: 2 17
SNMPv2-SMI::enterprises.9.9.109.1.1.1.1.8.2098 = Gauge32: 418
19
[root@localhost ~]# snmpwalk -v 2c -c cisco 10.75.39.20 1.3.6.1.2.1.47.1.1.1.1.7 | grep 5269095520
SNMPv2-SMI::mib-2.47.1.1.1.1.7.52690955 = STRING: "module 0/RSP0/CPU0" <<<<21
[root@localhost ~]#FAN SPEED
1
[root@xuxing ~]# snmpwalk -v 2c -c public 10.75.49.9 1.3.6.1.2.1.47.1.1.1.1.7 | grep speed <<<get sensor2
SNMPv2-SMI::mib-2.47.1.1.1.1.7.6869781 = STRING: "speed 0/FT1/SP"3
[root@xuxing ~]# 4
[root@xuxing ~]# snmpwalk -v 2c -c public 10.75.49.9 1.3.6.1.2.1.47.1.1.1.1.4.6869781 <<<获得这个传感器name的ID5
SNMPv2-SMI::mib-2.47.1.1.1.1.4.6869781 = INTEGER: 188598106
[root@xuxing ~]# 7
[root@xuxing ~]# snmpwalk -v 2c -c public 10.75.49.9 1.3.6.1.2.1.47.1.1.1.1.7.18859810 <<<使用上面的传感器id获得name为小风扇fan2 FT18
SNMPv2-SMI::mib-2.47.1.1.1.1.7.18859810 = STRING: "fan2 0/FT1/SP"9
[root@xuxing ~]# snmpwalk -v 2c -c public 10.75.49.9 1.3.6.1.4.1.9.9.91.1.1.1.1.4.6869781 <<<获得转速10
SNMPv2-SMI::enterprises.9.9.91.1.1.1.1.4.6869781 = INTEGER: 4440FAN STATE
1
[root@xuxing ~]# snmpwalk -v 2c -c public 10.75.49.9 1.3.6.1.2.1.47.1.1.1.1.7 | grep fantray2
SNMPv2-SMI::mib-2.47.1.1.1.1.7.25315280 = STRING: "fantray 0/FT1/SP"3
SNMPv2-SMI::mib-2.47.1.1.1.1.7.59316821 = STRING: "fantray 0/FT0/SP"4
[root@xuxing ~]# 5
[root@xuxing ~]# 6
[root@xuxing ~]# 7
[root@xuxing ~]# snmpwalk -v 2c -c public 10.75.49.9 1.3.6.1.4.1.9.9.117.1.4.1.1.1.25315280 <<<<获得FAN tray的状态,2表示是正常的8
SNMPv2-SMI::enterprises.9.9.117.1.4.1.1.1.25315280 = INTEGER: 29
[root@xuxing ~]# snmpwalk -v 2c -c public 10.75.49.9 1.3.6.1.4.1.9.9.117.1.4.1.1.1.5931682110
SNMPv2-SMI::enterprises.9.9.117.1.4.1.1.1.59316821 = INTEGER: 211
[root@xuxing ~]#POWER MOUDLE STATE
1
[root@xuxing ~]# snmpwalk -v 2c -c public 10.75.49.9 1.3.6.1.2.1.47.1.1.1.1.7 | grep power-module2
SNMPv2-SMI::mib-2.47.1.1.1.1.7.36029366 = STRING: "power-module 0/PS1/M3/SP"3
SNMPv2-SMI::mib-2.47.1.1.1.1.7.39915627 = STRING: "power-module 0/PS0/M3/SP"4
SNMPv2-SMI::mib-2.47.1.1.1.1.7.65324228 = STRING: "power-module 0/PS1/M0/SP"5
SNMPv2-SMI::mib-2.47.1.1.1.1.7.66531208 = STRING: "power-module 0/PS0/M0/SP"6
7
[root@xuxing ~]# snmpwalk -v 2c -c public 10.75.49.9 1.3.6.1.4.1.9.9.117.1.1.2.1.2.36029366 <<<获得Power module的状态,2表示正常的8
SNMPv2-SMI::enterprises.9.9.117.1.1.2.1.2.36029366 = INTEGER: 29
[root@xuxing ~]# snmpwalk -v 2c -c public 10.75.49.9 1.3.6.1.4.1.9.9.117.1.1.2.1.2.3991562710
SNMPv2-SMI::enterprises.9.9.117.1.1.2.1.2.39915627 = INTEGER: 211
[root@xuxing ~]#TEMPERATURES
1
[root@xuxing ~]# snmpwalk -v 2c -c public 10.75.49.9 1.3.6.1.2.1.47.1.1.1.1.7 | grep temperature | grep 0/RSP0/CPU0 <<<取得温度传感器对应的值2
SNMPv2-SMI::mib-2.47.1.1.1.1.7.12004356 = STRING: "temperature 0/RSP0/CPU0"3
SNMPv2-SMI::mib-2.47.1.1.1.1.7.12005976 = STRING: "temperature 0/RSP0/CPU0"4
SNMPv2-SMI::mib-2.47.1.1.1.1.7.28781969 = STRING: "temperature 0/RSP0/CPU0"5
SNMPv2-SMI::mib-2.47.1.1.1.1.7.28783653 = STRING: "temperature 0/RSP0/CPU0"6
SNMPv2-SMI::mib-2.47.1.1.1.1.7.45559678 = STRING: "temperature 0/RSP0/CPU0"7
SNMPv2-SMI::mib-2.47.1.1.1.1.7.45561266 = STRING: "temperature 0/RSP0/CPU0"8
SNMPv2-SMI::mib-2.47.1.1.1.1.7.62337227 = STRING: "temperature 0/RSP0/CPU0"9
[root@xuxing ~]# 10
[root@xuxing ~]# 11
[root@xuxing ~]# 12
[root@xuxing ~]# snmpwalk -v 2c -c public 10.75.49.9 1.3.6.1.2.1.47.1.1.1.1.4.12004356 <<<根据传感器的值获得name对应的ID13
SNMPv2-SMI::mib-2.47.1.1.1.1.4.12004356 = INTEGER: 3855723914
[root@xuxing ~]# snmpwalk -v 2c -c public 10.75.49.9 1.3.6.1.2.1.47.1.1.1.1.2.3855723915
SNMPv2-SMI::mib-2.47.1.1.1.1.2.38557239 = STRING: "RSP Card host "16
[root@xuxing ~]# snmpwalk -v 2c -c public 10.75.49.9 1.3.6.1.4.1.9.9.91.1.1.1.1.4.12004356 <<<获得传感器下对应的CPU温度17
SNMPv2-SMI::enterprises.9.9.91.1.1.1.1.4.12004356 = INTEGER: 34018
[root@xuxing ~]#19
20
21
0/RSP0/*22
host die_CPU 34.0 <<<< 对应这个温度. 23
host die_FabArbiter0 35.024
host die_FIA 38.025
host die_PCH 41.026
host die_DIMM0 33.027
host die_DIMM1 33.0TIPS
1
- 请添加SystemOwner的权限,要不然一些Fan speed之类的传感器的OID获得不到。2
>snmp-server community cisco RW SystemOwner3
4
- 请安装mgbl的PIE,要不然一些板卡,风扇的OID会获得不到。5
>disk0:asr9k-mgbl-px-6.3.3
This blog from Xuxing's blog; Link: http://imxing.cn/?p=134