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/down
2
ifOperStatus 1.3.6.1.2.1.2.2.1.8 <<<< 端口运行状态 up/down
3
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 <<<<端口别名/即端口description
SHOW INTERFACE下的LAST LINK FLAP时间
1
RP/0/RP0/CPU0:CORE6-ASR9922-A#show int hundredGigE 0/0/0/6 | in flapped
2
Tue Nov 27 21:07:00.288 UTC
3
Last link flapped 01:07:40
4
5
We need following OID
6
7
1.3.6.1.2.1.2.2.1.2 ifDescr <<< get interface name and ifindex
8
1.3.6.1.2.1.2.2.1.9 ifLastChange <<< get the time of sysUpTime when interface state change
9
1.3.6.1.2.1.1.3.0 sysUpTimeInstance <<< get sysUpTime
10
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/6
16
IF-MIB::ifDescr.104 = STRING: HundredGigE0/0/0/6
17
[root@xuxing ~]# snmpwalk -v 2c -c cisco 10.75.49.13 1.3.6.1.2.1.2.2.1.9.104
18
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.0
20
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 output
SHOW INTERFACE下的CRC计数
1
RP/0/RSP0/CPU0:ASR9006-F# show int tenGigE 1/0/0/1 | in CRC
2
Tue Dec 18 18:55:53.560 UTC
3
559851 input errors, 55 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
4
RP/0/RSP0/CPU0:ASR9006-F#
5
6
we need following OID
7
8
1.3.6.1.2.1.2.2.1.2 ifDescr
9
1.3.6.1.2.1.10.7.11.1.2 dot3HCStatsFCSErrors
10
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 ifname
12
IF-MIB::ifDescr.375 = STRING: TenGigE1/0/0/1
13
[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 counter
14
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.5
3
ciscoMemoryPoolFree: 1.3.6.1.4.1.9.9.48.1.1.1.6
4
*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 free
7
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.18
10
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.18.18788073.1 = Counter64: 2836322328
11
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.18.18788073.2 = Counter64: 134217728
12
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.18.18788073.3 = Counter64: 74158304
13
14
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.18.52690955.1 = Counter64: 2167614624
15
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.18.52690955.2 = Counter64: 134217728
16
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.18.52690955.3 = Counter64: 73829464
17
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.20
21
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.20.18788073.1 = Counter64: 5544935424
22
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.20.18788073.2 = Counter64: 0
23
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.20.18788073.3 = Counter64: 0
24
25
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.20.52690955.1 = Counter64: 6213971968
26
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.20.52690955.2 = Counter64: 0
27
SNMPv2-SMI::enterprises.9.9.221.1.1.1.1.20.52690955.3 = Counter64: 0
28
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 18788073
32
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 52690955
36
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 UTC
41
42
node: node0_0_CPU0
43
------------------------------------------------------------------
44
Physical Memory: 8192M total
45
Application Memory : 7992M (5288M available)
46
Image: 70M (bootram: 70M)
47
Reserved: 128M, IOMem: 0, flashfsys: 0
48
Total shared window: 128M
49
50
node: node0_RSP0_CPU0
51
------------------------------------------------------------------
52
Physical Memory: 8192M total (5923M available)
53
Application Memory : 7993M (5923M available)
54
Image: 70M (bootram: 70M)
55
Reserved: 128M, IOMem: 0, flashfsys: 0
56
Total shared window: 41M
监控板卡的CPU利用率
1
>1.3.6.1.4.1.9.9.109.1.1.1.1.7 cpmCPUTotal1minRev <<<1min
2
>1.3.6.1.4.1.9.9.109.1.1.1.1.8 cpmCPUTotal5minRev <<<5min
3
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.1
6
SNMPv2-SMI::enterprises.9.9.109.1.1.1.1.2.2 = INTEGER: 52690955 <<< this is card type
7
SNMPv2-SMI::enterprises.9.9.109.1.1.1.1.2.18 = INTEGER: 26932192
8
SNMPv2-SMI::enterprises.9.9.109.1.1.1.1.2.2082 = INTEGER: 18788073
9
SNMPv2-SMI::enterprises.9.9.109.1.1.1.1.2.2098 = INTEGER: 8695772
10
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: 1
12
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: 4
14
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: 1
16
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: 4
18
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 52690955
20
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 sensor
2
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的ID
5
SNMPv2-SMI::mib-2.47.1.1.1.1.4.6869781 = INTEGER: 18859810
6
[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 FT1
8
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: 4440
FAN 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 fantray
2
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: 2
9
[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.59316821
10
SNMPv2-SMI::enterprises.9.9.117.1.4.1.1.1.59316821 = INTEGER: 2
11
[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-module
2
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: 2
9
[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.39915627
10
SNMPv2-SMI::enterprises.9.9.117.1.1.2.1.2.39915627 = INTEGER: 2
11
[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对应的ID
13
SNMPv2-SMI::mib-2.47.1.1.1.1.4.12004356 = INTEGER: 38557239
14
[root@xuxing ~]# snmpwalk -v 2c -c public 10.75.49.9 1.3.6.1.2.1.47.1.1.1.1.2.38557239
15
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: 340
18
[root@xuxing ~]#
19
20
21
0/RSP0/*
22
host die_CPU 34.0 <<<< 对应这个温度.
23
host die_FabArbiter0 35.0
24
host die_FIA 38.0
25
host die_PCH 41.0
26
host die_DIMM0 33.0
27
host die_DIMM1 33.0
TIPS
1
- 请添加SystemOwner的权限,要不然一些Fan speed之类的传感器的OID获得不到。
2
>snmp-server community cisco RW SystemOwner
3
4
- 请安装mgbl的PIE,要不然一些板卡,风扇的OID会获得不到。
5
>disk0:asr9k-mgbl-px-6.3.3
This blog from Xuxing's blog; Link: http://imxing.cn/?p=134