posts - 156,  comments - 601,  trackbacks - 0



          spy2servers項(xiàng)目發(fā)布后,得到很多朋友的支持,本人在此表示感謝。本次更新,主要實(shí)現(xiàn)了內(nèi)置了Jetty Web服務(wù)器,提供
          基于web方式查看監(jiān)控平臺(tái)的所有組件運(yùn)行狀態(tài)。針對(duì)原來(lái)提供的基于JMX的運(yùn)行狀態(tài)監(jiān)控相比,Web方式要方便很多,無(wú)需運(yùn)行jconsole。

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

          我來(lái)看一下如何在 spy2servers 配置Jetty并啟動(dòng)web方式的組件監(jiān)控服務(wù)。
          配置方法非常簡(jiǎn)單,使用我們簡(jiǎn)單后的Spring配置。下面是配置說(shuō)明,在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>

          配置是不是非常的簡(jiǎn)單, 這樣就啟動(dòng)了web服務(wù) 訪問(wèn)址 http://localhost:7758/admin。 使用的是7758端口,servlet path是/admin.

          下面看一下,進(jìn)入后頁(yè)面的內(nèi)容:



          最上面分別是三個(gè)標(biāo)簽:分別選擇查看 SpyComponents AlertComponents ChannelAwareComponents 三種組件組件。默認(rèn)進(jìn)入的是SpyComponents

          上面圖片中,我們可以看到SpyComponents類共配置了三個(gè)監(jiān)控組件。
          我們拿其中一個(gè)再說(shuō)明一下:
          ActiveMQJmxSpyComponent
          message count=0 #監(jiān)控消息個(gè)數(shù)
          component status=Active #組件的狀態(tài)
          startup date=2008-04-22 22:25:09 #組件啟動(dòng)的時(shí)間

          如果有消息監(jiān)控到,則會(huì)顯示如下:
          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}


          接下來(lái),細(xì)心的朋友發(fā)現(xiàn)還有一個(gè)AlertRule鏈接,這個(gè)又不是組件,這個(gè)是做什么的呢?
          現(xiàn)在我來(lái)解釋一下,我們?cè)诙xcore-componet標(biāo)簽的時(shí)候,平臺(tái)支持定義消息的流轉(zhuǎn)規(guī)則,下面這是可視化的標(biāo)識(shí)哪些消息從那個(gè)監(jiān)控
          組件過(guò)來(lái),將會(huì)發(fā)送到哪個(gè)報(bào)警組件消息上去

          下面是一個(gè)演示界面:

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

          其中的內(nèi)容很好解理,from就是指監(jiān)控組件, to指的就是報(bào)警組件。

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

          最后歡迎大家如果有問(wèn)題和意見(jiàn),給我留言。

          Good Luck!
          Yours Matthew!


          posted on 2008-04-24 09:36 x.matthew 閱讀(2999) 評(píng)論(1)  編輯  收藏 所屬分類: Spy2Servers
          主站蜘蛛池模板: 株洲市| 缙云县| 汨罗市| 汝南县| 台东县| 德江县| 滕州市| 六安市| 宕昌县| 巴南区| 合作市| 沂水县| 中西区| 普兰店市| 隆尧县| 凌云县| 台东县| 托克托县| 荆州市| 彭山县| 水富县| 蒲城县| 赤城县| 胶州市| 平江县| 永安市| 遂平县| 商都县| 韩城市| 宜宾市| 嫩江县| 依兰县| 岳普湖县| 榕江县| 宝丰县| 楚雄市| 永修县| 大足县| 临城县| 临沭县| 嘉义县|