如何使用MIB讀取光模塊的收發光功率

2015/3/3 17:13:46點擊:
問題描述

如何使用MIB讀取接口收發光功率

處理(lǐ)過程

1、首先,在華為的私有(yǒu)MIB中有(yǒu)一個(gè)hwEntityExtentMIB,其中的兩個(gè)節點分别标明(míng)了收發光功率,節點名和(hé)OID分别如下

 Name: hwEntityOpticalRxPower 

Type: OBJECT-TYPE 
OID: 1.3.6.1.4.1.2011.5.25.31.1.1.3.1.8

Name: hwEntityOpticalTxPower 
Type: OBJECT-TYPE 
OID: 1.3.6.1.4.1.2011.5.25.31.1.1.3.1.9

 2、讀取這兩個(gè)節點,可(kě)以得(de)到光功率,以收光功率為例

***** SNMP QUERY STARTED ***** 
1: hwEntityOpticalRxPower.17170689 (integer) 0 
2: hwEntityOpticalRxPower.17170690 (integer) 0 
3: hwEntityOpticalRxPower.17170691 (integer) -3301 
4: hwEntityOpticalRxPower.17170692 (integer) 0 
5: hwEntityOpticalRxPower.17170693 (integer) 0 
6: hwEntityOpticalRxPower.17170694 (integer) 0 
7: hwEntityOpticalRxPower.17170695 (integer) 0 
8: hwEntityOpticalRxPower.17170696 (integer) 0 
9: hwEntityOpticalRxPower.17432833 (integer) -568 
10: hwEntityOpticalRxPower.17432834 (integer) -548 
11: hwEntityOpticalRxPower.17432835 (integer) 0 
12: hwEntityOpticalRxPower.17432836 (integer) 0 
13: hwEntityOpticalRxPower.17563905 (integer) 0 
14: hwEntityOpticalRxPower.17563906 (integer) -3301 
15: hwEntityOpticalRxPower.17563907 (integer) -483 
16: hwEntityOpticalRxPower.17563908 (integer) -537 
17: hwEntityOpticalRxPower.17563909 (integer) -572 
18: hwEntityOpticalRxPower.17563910 (integer) -4000 
19: hwEntityOpticalRxPower.17563911 (integer) -2769 
20: hwEntityOpticalRxPower.17563912 (integer) -2958 
21: hwEntityOpticalRxPower.17563913 (integer) -445 
22: hwEntityOpticalRxPower.17563914 (integer) -3096 
23: hwEntityOpticalRxPower.17563915 (integer) -4000 
24: hwEntityOpticalRxPower.17563916 (integer) -752 
25: hwEntityOpticalRxPower.17564161 (integer) -4000 
***** SNMP QUERY FINISHED ***** 

3、下一步要做(zuò)的,就是如何将光功率和(hé),接口對應,這裏使用的不是常用的ifindex,其實收發光功率節點所在的表接口,描述信息中,說明(míng)了這個(gè)表的索引,使用的是entPhysicalIndex

 Name: hwOpticalModuleInfoEntry 

Type: OBJECT-TYPE 
OID: 1.3.6.1.4.1.2011.5.25.31.1.1.3.1

 Indexes: 1: entPhysicalIndex

 4、搜索該節點entPhysicalIndex ,可(kě)以看到一個(gè)表

這個(gè)表中有(yǒu)兩個(gè)節點,分别是實體(tǐ)的描述和(hé)實體(tǐ)的名字,在實體(tǐ)的描述中可(kě)以看到光模塊類型,實體(tǐ)的名字中,可(kě)以看到接口和(hé)索引的對應關系

Name: entPhysicalDescr 
Type: OBJECT-TYPE 
OID: 1.3.6.1.2.1.47.1.1.1.1.2

 Name: entPhysicalName 

Type: OBJECT-TYPE 
OID: 1.3.6.1.2.1.47.1.1.1.1.7

 比如收發光功率中,24: hwEntityOpticalRxPower.17563916 (integer) -752 ,索引為17563916的接口光模塊收光功率為-752

 根據這個(gè)索引,讀取entPhysicalDescr 和(hé)entPhysicalName ,可(kě)以得(de)到光模塊的類型及對應接口

 1: entPhysicalDescr.17563916 (octet string) 2100Mb/s-850nm-LC-300m(0.05mm)-150m(0.0625mm)

1: entPhysicalName.17563916 (octet string) GigabitEthernet12/0/11

 5、值得(de)注意的是,在接口收發光功率的節點描述中,說明(míng)了MIB讀取到的值需要乘100

 Name: hwEntityOpticalRxPower 

Type: OBJECT-TYPE 
OID: 1.3.6.1.4.1.2011.5.25.31.1.1.3.1.8 

 Description: The receive power of the optical module. Unit: dBm. the value is expanded 100 times,so the real value should be reduced 100 times 

根因

根據索引可(kě)以确認接口光功率

解決方案 

根據索引可(kě)以确認接口光功率 

建議與總結
MIB-browser是處理(lǐ)MIB類問題的重要工具