afunms

          My Software,My Dream—Forge a more perfect NMS product.

          PSAX Trap 翻譯(4)

          有了以上三張表,很容易把PSAX Trap翻譯過來:
          /**
               * 翻譯snmp trap
               
          */

              
          private String translatePsaxTrap(Connection conn,SnmptrapDto dto) throws Exception{
                  StringBuffer trap 
          = new StringBuffer(200
          );
                  Statement stat 
          =
           conn.createStatement();
                  String oid 
          = dto.getOid() + "." +
           dto.getSpecifics();
                  ResultSet rs 
          = stat.executeQuery("select b.description from acmib_oid a,acmib_event b where a.oid='" + oid + "' and a.symbol=b.symbol"
          );
                  
          if
          (rs.next())
                      trap.append(rs.getString(
          1
          ));
                  
                  String[] msgs 
          = dto.getMessage().split(","
          );
                  
          /**
                   * 過濾掉最后一行1.3.6.1.4.1.1751.2.18.1.146.
                   
          */

                  
          for(int i=0;i < msgs.length - 1;i++){
                      String[] _msgs 
          = msgs[i].split("="
          );
                      String _oid 
          = _msgs[0].substring(0,_msgs[0].length() - 3); //去掉最后.0

                      String _value = _msgs[1].trim();            
                      rs 
          = stat.executeQuery("select * from acmib_oid where oid='" + _oid + "'"
          );
                      
          if(rs.next())
          {
                          trap.append(rs.getString(
          "symbol")).append("=").append(_msgs[1
          ]);
                          
          if(rs.getString("symbol").endsWith("Code"))
          {
                              ResultSet _rs 
          = stat.executeQuery("select * from acmib_code where symbol='" + rs.getString("symbol"+ "' and code=" +
           _value);
                              
          if
          (_rs.next())
                                  trap.append(
          "[").append(_rs.getString("description")).append("]"
          );
                          }

                          trap.append(
          ",");
                      }
                      
                  }

                  
          return trap.toString();
              }
          (這里省略了接受SNMP Trap的代碼)

          舉例1:
          Trap原包內(nèi)容:
          oid=
          1.3.6.1.4.1.1751.2.18.8.4
          specifics=67
          message=
          1.3.6.1.4.1.1751.2.18.6.31.1.1.0 = 1309001,
          1.3.6.1.4.1.1751.2.18.6.33.1.1.0 = 14,
          1.3.6.1.4.1.1751.2.18.6.33.1.2.0 = 153,
          1.3.6.1.4.1.1751.2.18.6.33.1.3.0 = 45:86:20:02:00:88:01:00:0f:00:00:00:00:00:00:06:00:90:01:77,
          1.3.6.1.4.1.1751.2.18.6.33.1.4.0 = 301001,
          1.3.6.1.4.1.1751.2.18.6.33.1.5.0 = 0,
          1.3.6.1.4.1.1751.2.18.6.33.1.6.0 = 669,
          1.3.6.1.4.1.1751.2.18.1.146.1.1.0 = 100286

          翻譯后:
          Notification that a SPVC connection between ATM and ATM endpoints has been deleted. spvcAddrIfA= 1309001,
          atmAtmSpvcVccVpiA= 14,
          atmAtmSpvcVccVciA= 153,
          atmAtmSpvcVccRemoteAtmPortAddr= 45:86:20:02:00:88:01:00:0f:00:00:00:00:00:00:06:00:90:01:77,
          atmAtmSpvcVccIfB= 301001,
          atmAtmSpvcVccVpiB= 0,
          atmAtmSpvcVccVciB= 669,
          (這個atmAtmSpvcVccRemoteAtmPortAddr應(yīng)該能轉(zhuǎn)成一個IP或Interface,暫時沒搞明白)
          很明顯,可以明白是一條ATM2ATM的SPVC被刪除。

          舉例2:
          Trap原包內(nèi)容:
          oid=
          1.3.6.1.4.1.1751.2.18.8.3
          specifics=104
          message=
          1.3.6.1.4.1.1751.2.18.15.2.0 = 1309001,
          1.3.6.1.4.1.1751.2.18.15.4.0 = 67,
          1.3.6.1.4.1.1751.2.18.1.146.1.1.0 = 100374,
          翻譯后:
          Notification that a interface has undergone reduction in bandwidth. Critical depending on  Failure Reason Code.interfaceIndex= 1309001,interfaceFailureReasonCode= 67[newBWBelowCurrentAllocated]
          可以看明白,是一個通道的帶寬被改小了。

          posted on 2009-10-24 01:16 afunms 閱讀(123) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           

          My Links

          News

          留言簿(18)

          隨筆檔案

          相冊

          搜索

          最新評論

          閱讀排行榜

          主站蜘蛛池模板: 五原县| 新野县| 怀宁县| 临澧县| 南宫市| 巨野县| 青冈县| 湖南省| 沽源县| 常熟市| 武城县| 徐闻县| 井研县| 大方县| 恩平市| 明光市| 北票市| 鄂托克旗| 广州市| 南靖县| 寻乌县| 讷河市| 读书| 长岛县| 永安市| 特克斯县| 亚东县| 资兴市| 台州市| 大荔县| 麻城市| 澄城县| 河池市| 华阴市| 富锦市| 绥德县| 香河县| 南昌县| 灵宝市| 忻城县| 万源市|