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原包內容:
          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應該能轉成一個IP或Interface,暫時沒搞明白)
          很明顯,可以明白是一條ATM2ATM的SPVC被刪除。

          舉例2:
          Trap原包內容:
          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)  編輯  收藏


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


          網站導航:
           

          My Links

          News

          留言簿(18)

          隨筆檔案

          相冊

          搜索

          最新評論

          閱讀排行榜

          主站蜘蛛池模板: 天等县| 清新县| 隆昌县| 清水河县| 平山县| 疏勒县| 荃湾区| 囊谦县| 唐河县| 利津县| 垣曲县| 平南县| 平罗县| 江西省| 浪卡子县| 肇州县| 灵川县| 苍梧县| 大埔县| 莫力| 张家港市| 株洲市| 巴塘县| 江北区| 鲁甸县| 蕉岭县| 临邑县| 石城县| 宁城县| 霍城县| 邵阳市| 淮安市| 买车| 镇巴县| 阳西县| 中西区| 黄冈市| 乌审旗| 湛江市| 共和县| 明星|