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 阅读(2976) 评论(1)  编辑  收藏 所属分类: Spy2Servers

只有注册用户登录后才能发表评论。


网站导航: