(原创)放出ActiveMQ服务监控组件-基于组件化的监控平台开发

(原创)放出ActiveMQ服务监控组件-基于组件化的监控平台开发

上次基于 组件化的监控平台开发一个 Tomcat监控插件和邮件报警插件
收到有很多朋友的支持,在些表示非常感谢。这次发布的将包含一个AMQ的监控组件。

下载地址
二进制程序
第三方类库下载, 第三方类库下载2 放到lib目录下。
api-docs
源代码


先来介绍ActiveMQ服务监控组件的实现,该监控组件目前实现了以下方面信息的监控:
1. Jvm堆内存和非堆内存的监控(可以设置使用的百分比或是具体使用的内存大小)
2. 当前操作文件打开的IO文件个数监控。 一般操作默认设置的最大值是1024,如果超过这个服务会导致JVM所有服务的停止。
3. Queue队列的消息者监控。如果某一个队列在设定时间段时都没有消息者监听可以监控该状态信息
4. 监控所有非法IP连接.如果有未设定的非法IP连接可以组件监控其非法IP地址,但进行报警

因为该组件利用JMX技术对ActiveMQ进行监控,AcitveMQ默认状态下其JMX服务是打开着的,端口为1099.如果没有打开,可以修改其配置文件 conf/activemq.xml
activemq 4.x

 <broker brokerName="localhost" useJmx="true" xmlns="http://activemq.org/config/1.0">


下面我们来看一下该监控组件的实现类图


下面我们来操作一下如何使用Spring注册该组件(spy2servers.xml),使用其监控平台工作起来。

 1       < bean  class ="org.xmatthew.spy2servers.component.spy.jmx.ActiveMQJmxSpyComponent" >
 2           < property  name ="host"  value ="x.x.x.x" ></ property >
 3           < property  name ="port"  value ="1099" ></ property >
 4 
 5           < property  name ="heapMemorySpy" >
 6               < bean  class ="org.xmatthew.spy2servers.component.spy.jmx.MemorySpy" >
 7                   < property  name ="memoryUsedPercentToAlert"  value ="5" ></ property >
 8                   < property  name ="alertAfterKeepTimeLive"  value ="10" ></ property >
 9               </ bean >
10           </ property >
11           < property  name ="fileSpy" >
12               < bean  class ="org.xmatthew.spy2servers.component.spy.jmx.FileSpy" >
13                   < property  name ="filesOpenedPercentToAlert"  value ="8" ></ property >
14                   < property  name ="alertAfterKeepTimeLive"  value ="2" ></ property >
15               </ bean >
16           </ property >     
17           < property  name ="destinationNamesToWatch" >
18               < set >
19                   <!--  if blank will inspect all queue names  -->
20                   < value > Test.Queue </ value >
21               </ set >
22           </ property >
23           <!--  if queue's consumers suspend for this time will alert   -->
24           < property  name ="queueSuspendNotifyTime"  value ="2000" ></ property >
25           <!--  any allow ip. if ip not in this list will component will alert  -->
26           < property  name ="llegalIps" >
27               < set >
28                   < value > 127.0.0.1 </ value >
29               </ set >
30           </ property >
31       </ bean >


好了,基本的配置最是这些,应用程序和源代码已经上传大家可以自写阅览。大家如有任何问题请回复给我。

Good luck!
Yours Matthew!



你可能感兴趣的:((原创)放出ActiveMQ服务监控组件-基于组件化的监控平台开发)