posts - 156,  comments - 601,  trackbacks - 0



          spy2servers項目發布后,得到很多朋友的支持,本人在此表示感謝。本次更新,主要實現了內置了Jetty Web服務器,提供
          基于web方式查看監控平臺的所有組件運行狀態。針對原來提供的基于JMX的運行狀態監控相比,Web方式要方便很多,無需運行jconsole。

          下載地址:
          二進制程序
          第三方類庫下載,第三方類庫下載2  Jetty類庫 放到lib目錄下。
          api-docs
          源代碼

          我來看一下如何在 spy2servers 配置Jetty并啟動web方式的組件監控服務。
          配置方法非常簡單,使用我們簡單后的Spring配置。下面是配置說明,在spy2servers.xml中,加入

            <jetty>
              
          <connectors>
                
          <nioConnector port="7758" /> <!-- using nio connector port is 7758 -->
              
          </connectors>

              
          <handlers>
                  
          <!-- org.xmatthew.spy2servers.component.web.ComponentsViewServlet is our web spy servlet,  /admin is our servlet path  -->
                
          <servlet servletClass="org.xmatthew.spy2servers.component.web.ComponentsViewServlet" path="/admin" />
              
          </handlers>
            
          </jetty>

          配置是不是非常的簡單, 這樣就啟動了web服務 訪問址 http://localhost:7758/admin。 使用的是7758端口,servlet path是/admin.

          下面看一下,進入后頁面的內容:



          最上面分別是三個標簽:分別選擇查看 SpyComponents AlertComponents ChannelAwareComponents 三種組件組件。默認進入的是SpyComponents

          上面圖片中,我們可以看到SpyComponents類共配置了三個監控組件。
          我們拿其中一個再說明一下:
          ActiveMQJmxSpyComponent
          message count=0 #監控消息個數
          component status=Active #組件的狀態
          startup date=2008-04-22 22:25:09 #組件啟動的時間

          如果有消息監控到,則會顯示如下:
          ActiveMQJmxSpyComponent
          message count=2
          component status=Active
          startup date=2008-04-22 22:25:09
          order 1
          id c7c41f6b-a502-4656-862b-869e1dbe8260
          level 1
          body Test.Queue
          description QueueConsumerSuspend
          type QueueInspect
          properties {Name=Test.Queue, MemoryPercentageUsed=0, DispatchCount=0, QueueSize=0, EnqueueCount=0, DequeueCount=0, ConsumerCount=0, MemoryLimit=9223372036854775807, statusKeepTime=18968}
          order 2
          id a5b0dbce-b0ae-41d6-8690-0d0ebf9a34b5
          level 1
          body aaa
          description QueueConsumerSuspend
          type QueueInspect
          properties {Name=aaa, MemoryPercentageUsed=0, DispatchCount=0, QueueSize=0, EnqueueCount=0, DequeueCount=0, ConsumerCount=0, MemoryLimit=9223372036854775807, statusKeepTime=18796}


          接下來,細心的朋友發現還有一個AlertRule鏈接,這個又不是組件,這個是做什么的呢?
          現在我來解釋一下,我們在定義core-componet標簽的時候,平臺支持定義消息的流轉規則,下面這是可視化的標識哪些消息從那個監控
          組件過來,將會發送到哪個報警組件消息上去

          下面是一個演示界面:

          Components alert rule:
          from to
          AMQ16Component PrintScreenAlertComponent
          ActiveMQJmxSpyComponent PrintScreenAlertComponent
          EmailAlertComponent
          SunJVMJmxSpyComponent PrintScreenAlertComponent
          EmailAlertComponent
          TomcatJmxSpyComponent PrintScreenAlertComponent
          EmailAlertComponent

          其中的內容很好解理,from就是指監控組件, to指的就是報警組件。

          基于web方式的查看監控的組件情況,是不是很方便呢 :)。

          最后歡迎大家如果有問題和意見,給我留言。

          Good Luck!
          Yours Matthew!


          posted on 2008-04-24 09:36 x.matthew 閱讀(3002) 評論(1)  編輯  收藏 所屬分類: Spy2Servers
          主站蜘蛛池模板: 贺州市| 嘉鱼县| 灵宝市| 嘉义县| 加查县| 南陵县| 临西县| 睢宁县| 太康县| 洛扎县| 明星| 霞浦县| 栖霞市| 诏安县| 新余市| 衡东县| 城口县| 沭阳县| 都兰县| 通江县| 岳西县| 夏邑县| 阳东县| 北辰区| 邵东县| 荃湾区| 云阳县| 南涧| 博爱县| 汉中市| 晋宁县| 阜新市| 瓮安县| 巢湖市| 夏津县| 攀枝花市| 凤翔县| 新乐市| 苗栗县| 鞍山市| 龙门县|