使用JMX产品jolokia对Mule esb进行监控
来源:互联网 发布:nba球员数据排名 编辑:程序博客网 时间:2024/05/01 04:14
jolokia 1.0.6:http://www.jolokia.org/agent/mule.html
Mule esb 3.3.0:http://www.mulesoft.org
现在越来越多的集成平台使用了Mule企业服务总线中间件,Mule企业版的监控程序是收费的,不过Mule大佬还算有点良心,实现了很多MBEAN接口,提供了很JMX接口,这使得自定义监控界面得以实现。
准备实现的结构图如下:
在Mule里面添加JMX代理,新建一个flow,代码如下:
<?xml version="1.0" encoding="UTF-8"?><mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:management="http://www.mulesoft.org/schema/mule/management" xmlns:spring="http://www.springframework.org/schema/beans" xsi:schemaLocation=" http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.mulesoft.org/schema/mule/management http://www.mulesoft.org/schema/mule/management/3.1/mule-management.xsd"> <!-- jmx配置 --> <custom-agent name="jolokia-agent" class="org.jolokia.mule.JolokiaMuleAgent"> <spring:property name="port" value="8099"/> </custom-agent> <management:jmx-server> <management:connector-server url="service:jmx:rmi:///jndi/rmi://localhost:7099/mule" rebind="true" /> </management:jmx-server></mule>
附:需要把Mule-Agent的包: jolokia-mule-1.0.6-agent.jar添加到类目录
参考:http://www.jolokia.org/agent/mule.html
运行结果:
打印出如下信息表示添加JMX成功啦。
这样打开: http://casking-soa-PC:8099/jolokia 这个就可以查看版本了。
内存情况及回收操作:
http://127.0.0.1:8099/jolokia/read/java.lang:type=Memory
http://127.0.0.1:8099/jolokia/exec/java.lang:type=Memory/gc
操作系统信息
http://127.0.0.1:8099/jolokia/read/java.lang:type=OperatingSystem
运行环境
http://127.0.0.1:8099/jolokia/read/java.lang:type=Runtime
线程总体情况
http://127.0.0.1:8099/jolokia/read/java.lang:type=Threading
类加载情况
http://127.0.0.1:8099/jolokia/read/java.lang:type=ClassLoading
更多用法可以参见:http://www.jolokia.org/reference/html/protocol.html
有了API,你们就可以自己写自定义的界面了。
看我们的结构图,绿色部分有说提供标准的JMX API,我们来测试使用JConsole测试一下
此工具JDK自带的
双击打开,并填入RIM地址
除了上面系统自带的Mbean,我们还可以在Mule里面添加自己的Mbean,这样可以自由发挥啦
新建一个flow,代码如下:
<?xml version="1.0" encoding="UTF-8"?><mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.3.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> <spring:beans> <!-- 配置MBean自动注册 --><context:mbean-export default-domain="mule-csip-custom" registration="replaceExisting" /> <spring:bean class="cn.com.casking.csip.jmx.Test"/> </spring:beans></mule>
Test.java类对应的代码:
package cn.com.casking.csip.jmx;import org.springframework.jmx.export.annotation.ManagedAttribute;import org.springframework.jmx.export.annotation.ManagedOperation;import org.springframework.jmx.export.annotation.ManagedResource;@ManagedResource(objectName = Test.MBEAN_NAME, description = "测试的Mbean")public class Test {public static final String MBEAN_NAME = "mule-csip-custom:name=test";@ManagedAttribute(description = "属性测试")public int getAttr() {System.out.println("属性测试!!!");return 0;}@ManagedOperation(description = "方法测试")public void execOperation(String name) {System.out.println("方法测试!!!="+name);}}
使用Jconsole可以查看
当然也可以使用jolokia的API来打开:
1.获取属性:
http://127.0.0.1:8099/jolokia/read/mule-csip-custom:name=test/Attr
{"timestamp":1362052249,"status":200,"request":{"mbean":"mule-csip-custom:name=test","attribute":"Attr","type":"read"},"value":0}
2.执行方法:
http://127.0.0.1:8099/jolokia/exec/mule-csip-custom:name=test/execOperation/yangcai
返回结果:
{"timestamp":1362052156,"status":200,"request":{"operation":"execOperation","mbean":"mule-csip-custom:name=test","arguments":["yangcai"],"type":"exec"},"value":null}
- 使用JMX产品jolokia对Mule esb进行监控
- 如何使用JMX对Mule实现监控
- mule jmx远程监控
- 2010年度ESB产品盘点:开源ESB产品之Mule
- ESB之Mule ESB的使用
- 使用Zenoss对JMX的监控
- 【Mule ESB】:对MuleESB的简单认识
- 用JMX对Resin内存状态进行监控
- Mule ESB
- mule esb
- Mule ESB
- 如何对产品运营情况进行监控
- Mule ESB 学习笔记mule和jersey的整合使用
- Mule3用户手册:Mule ESB 3使用要点
- Mule3用户手册:Mule ESB 3使用要点
- Mule ESB使用之高并发问题
- Mule3用户手册:Mule ESB 3使用要点
- 使用JMX监控Tomcat
- JAVA如何判断两天在同一周内
- javascript 随机点名
- 将要到来的三大技术革命与联系
- Oracle数据库只读与可写状态的变更
- javascript实现文本域的写入字符个数 限定字数
- 使用JMX产品jolokia对Mule esb进行监控
- Could not load file or assembly 'System.Web.Extensions解决方案
- 进制转换
- NET自定义调试
- javascript加强
- TCP/IP及socket通信概览
- XP下Virtualbox虚拟Ubuntu共享文件夹设置
- 在Cocos2d 2.0中使用ARC的方法
- Ext store.loadData()执行后不显示数据