posts - 156,  comments - 601,  trackbacks - 0
          最近看到一位同事正在開發一個監控軟件,要求就是通過針對服務器現有的一些接口,通過這些接口返回的數據進行分析,如果監控的值到達預先設定的范圍則通過短信的方式發送給管理員。

          從整個開發的功能上來看是一個比較單一也很明確的功能,所開發的系統對所其所監控的軟件的依賴性也非常大,主要是監控的數據分析行為和監控信息的服務報警行為這塊。既然這兩塊很難做成一個通用的功能模塊,那就搭建一個監控平臺,可以讓這些功能模塊通過組件的方式自由的注冊和銷毀。


          所有我構思了這個監控平臺,它對外有三個接口,分別是監控接口,報警接口和監控消息監控接口。由平臺統一管理這些組件的生命周期,每個組件都過單獨的線程運行。提供一個核心組件CoreComponent調度所有監控數據的流轉。平臺本身還使用基于jmx管理服務技術提供對所有當前使用的組件運行情況的監控,也包括動態的啟動和停止組件的運行狀態。
           
          下載地址 
          二進制程序
          第三方類庫下載,第三方類庫下載放到lib目錄下。
          api-docs 
          源代碼


          /**
           * Component interface.
           * 組件接口,提供組件的基本管理服務和狀態監控。 所有組件必須要實現該接口。
           * 
           * 
          @author XieMaLin
           *
           
          */

          public interface Component {
              
              
          /**
               * component run status
               * 
               
          */

              
          public final static int ST_RUN = 1;
              
              
          /**
               * component run status name
               
          */

              
          public final static String ST_RUN_NAME = "Active";
              
              
          /**
               * component stop status
               
          */

              
          public final static int ST_STOP = 2;
              
              
          /**
               * component stop status name
               
          */

              
          public final static String ST_STOP_NAME = "Decctive";
              
              
          /**
               * get component status
               * <p>
               * One of ST_RUN, ST_STOP. 
               * 
          @return component status
               
          */

              
          public int getStatus();
              
              
          /**
               * get component status
               * <p>
               * One of ST_RUN_NAME, ST_STOP_NAME. 
               * 
               * 
          @return component status name
               
          */

              
          public String getStatusName();
              
              
          /**
               * if component active return true
               * 
               * 
          @return true if component is in status ST_RUN
               
          */

              
          public boolean isActive();
              
              
          /**
               * will be invoked after component plugs.
               
          */

              
          public void startup();

              
          /**
               * will be invoked after component unplugs.
               
          */

              
          public void stop();

              
          /**
               * set component context to the component.
               * it will auto invoke by CoreComponent
               * 
               * 
          @param context set the component context
               * 
               
          */

              
          public void setContext(ComponentContext context);

              
          /**
               * 
          @return get the component context
               
          */

              
          public ComponentContext getContext();
              
              
          /**
               * get component name
               * 
          @return get component name
               
          */

              
          public String getName();
              
              
          /**
               * get component strartup date
               * 
          @return get component strartup date
               
          */

              
          public Date getStartupDate();
              
              
          /**
               * set startup date to the component.
               * it will auto invoke by CoreComponent
               * 
               * 
          @param date startup date
               
          */

              
          public void setStartupDate(Date date);


          點擊查看具體內容:http://www.aygfsteel.com/xmatthew/articles/185673.html
          posted on 2008-03-12 13:48 x.matthew 閱讀(1586) 評論(2)  編輯  收藏 所屬分類: Spy2Servers
          主站蜘蛛池模板: 红桥区| 邹平县| 岐山县| 土默特左旗| 鞍山市| 嘉祥县| 凤城市| 江油市| 循化| 五常市| 汉寿县| 信宜市| 渭南市| 固原市| 丹巴县| 开阳县| 金川县| 马山县| 上饶市| 西藏| 阳江市| 九江县| 禄劝| 电白县| 敖汉旗| 宣恩县| 桐庐县| 资阳市| 三河市| 大冶市| 安西县| 达拉特旗| 会同县| 兴化市| 汨罗市| 佛冈县| 江津市| 扶风县| 普定县| 长顺县| 资阳市|