打开JMX

<broker … useJmx="true">

…

  <managementContext>

<managementContext createConnector="true"/>

</managementContext>

</broker>

启动ActiveMQ

$ activemq start

启动 JMX console

$ jconsole

选择远程进程,输入url:

service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi

访问ActiveMQ Jolokia REST API

read Reading of MBean attributes
write Setting of MBean attributes
exec Execution of JMX operations
list List the available MBeans along with their supported attributes and operations.
search Searching for MBeans
version Getting version and server information

每种命令的url格式。

<base-url>/read/<mbean name>/<attribute name>/<inner path>

<base url>/write/<mbean name>/<attribute name>/<value>/<inner path>

<base url>/exec/<mbean name>/<operation name>/<arg1>/<arg2>/....

<base-url>/search/<pattern>

<base-url>/list/<inner path>

<base-url>/version

例子:

拿到broker的属性值

http://localhost:8161/api/jolokia/read/org.apache.activemq:brokerName=localhost,type=Broker

{

"timestamp": 1463105087,

"status": 200,

"request": {

"mbean": "org.apache.activemq:brokerName=localhost,type=Broker",

"type": "read"

},

"value": {

"BrokerId": "ID:NOTE140082-51092-1463022383093-0:1",

"TemporaryQueues": [],

"StompSslURL": "",

"TemporaryTopicProducers": [],

"StoreLimit": 107374182400,

"TotalConsumerCount": 0,

"DurableTopicSubscribers": [],

"Slave": false,

"StompURL": "stomp:\/\/NOTE140082:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600",

"TopicSubscribers": [],

"QueueProducers": [],

"VMURL": "vm:\/\/localhost",

"Uptime": "22 hours 58 minutes",

"TotalMessageCount": 0,

"Topics": [

{

"objectName": "org.apache.activemq:brokerName=localhost,destinationName=ActiveMQ.Advisory.MasterBroker,destinationType=Topic,type=Broker"

},

{

"objectName": "org.apache.activemq:brokerName=localhost,destinationName=ActiveMQ.Advisory.Queue,destinationType=Topic,type=Broker"

}

],

"TopicProducers": [],

"BrokerName": "localhost",

"OpenWireURL": "tcp:\/\/NOTE140082:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600",

"MinMessageSize": 1024,

"QueueSubscribers": [],

"TotalDequeueCount": 0,

"TemporaryTopics": [],

"BrokerVersion": "5.13.2",

"AverageMessageSize": 1024,

"StorePercentUsage": 0,

"TemporaryQueueProducers": [],

"TotalEnqueueCount": 3,

"Persistent": true,

"TransportConnectors": {

"amqp": "amqp:\/\/NOTE140082:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600",

"mqtt": "mqtt:\/\/NOTE140082:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600",

"openwire": "tcp:\/\/NOTE140082:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600",

"ws": "ws:\/\/NOTE140082:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600",

"stomp": "stomp:\/\/NOTE140082:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"

},

"InactiveDurableTopicSubscribers": [],

"TemporaryTopicSubscribers": [],

"TemporaryQueueSubscribers": [],

"DynamicDestinationProducers": [],

"MemoryPercentUsage": 0,

"MemoryLimit": 726571418,

"Queues": [

{

"objectName": "org.apache.activemq:brokerName=localhost,destinationName=1111,destinationType=Queue,type=Broker"

},

{

"objectName": "org.apache.activemq:brokerName=localhost,destinationName=22222,destinationType=Queue,type=Broker"

}

],

"TotalConnectionsCount": 0,

"UptimeMillis": 82705502,

"DataDirectory": "E:\\apache-activemq-5.13.2\\data",

"TempLimit": 53687091200,

"JobSchedulerStoreLimit": 0,

"JobSchedulerStorePercentUsage": 0,

"SslURL": "",

"StatisticsEnabled": true,

"CurrentConnectionsCount": 0,

"JMSJobScheduler": null,

"TotalProducerCount": 0,

"MaxMessageSize": 1024,

"TempPercentUsage": 0

}

}

获取单个属性的值

http://localhost:8161/api/jolokia/read/org.apache.activemq:brokerName=localhost,type=Broker/BrokerId

http://localhost:8161/api/jolokia/read/org.apache.activemq:brokerName=localhost,type=Broker/ StompURL

搜索broker。

http://localhost:8161/api/jolokia/search/*:type=Broker,brokerName=*

这里可以用在初始获取broker信息的时候使用。因为如果activemq如果配置了jmxDomainName,<mbean name>就要写成:<jmxDomainName>:type,brokerName=。如果不配置默认是:org.apache.activemq。

<managementContext>

<managementContext createConnector="true" jmxDomainName="test.domain"/>

</managementContext>

http://localhost:8161/api/jolokia/read/test.domain:brokerName=localhost,type=Broker/BrokerId

这个能搜索所有的队列,包括队列的属性。但是如果当前没有队列,会返回错误。

http://localhost:8161/api/jolokia/read/org.apache.activemq:brokerName=localhost,type=Broker,destinationType=Queue,destinationName=*

通过broker的属性queues,只能拿到队列的名称列表,拿不到具体的队列属性。

http://localhost:8161/api/jolokia/read/test.domain:brokerName=localhost,type=Broker/Queues

jolokia官方在线文档:

https://jolokia.org/reference/html/index.html

jolokia官方pdf文档:

https://jolokia.org/reference/pdf/jolokia-reference.pdf

Activemq Jolokia的更多相关文章

  1. ActiveMQ点对点的消息发送案例

    公司最近会用MQ对某些业务进行处理,所以,这次我下载了apache-activemq-5.12.0-bin把玩下. 基于练习方便需要,使用Windows的版本. 参考的优秀文章: activemq的几 ...

  2. activemq.bat 在window7 x64下启动(安装)报错解决方案

    在启动  apache-activemq-5.15.2/activemq.bat  时候报错,提示以下信息: wrapper | --> Wrapper Started as Consolewr ...

  3. 【ActiveMQ】ActiveMQ在Windows的安装,以及点对点的消息发送案例

    公司最近会用MQ对某些业务进行处理,所以,这次我下载了apache-activemq-5.12.0-bin把玩下. 基于练习方便需要,使用Windows的版本. 参考的优秀文章: activemq的几 ...

  4. Windows下安装ActiveMQ

    到官网(http://activemq.apache.org/download-archives.html)下载最新发布的压缩包(我下的是5.15.9)到本地后解压(我解压到D盘Dev目录下)即可.进 ...

  5. activeMQ---->ActiveMQ的使用(一)

    这里通过一个入门的案例来体会一下ActiveMQ的作用以及使用方法.你要做一个不动声色的大人了.不准情绪化,不准偷偷想念,不准回头看.去过自己另外的生活.你要听话,不是所有的鱼都会生活在同一片海里. ...

  6. 使用jolokia api监控ActiveMQ

    jolokia api提供了一种通过HTTP访问JMX获得AMQ后台数据的一种方式,即Restful Api #!/usr/bin/env python # -*- coding:utf-8 -*- ...

  7. Apache ActiveMQの版本更迭和Apache ActiveMQの故障转移

    本文描述apache activemq 版本更迭的原因以及Apache ActiveMQのThe Failover Transport new features in 5.2.0  1.对信息的传输/ ...

  8. SharedFile System Master Slave(共享文件系统)做ActiveMQ集群

    WINDOWS环境下:http://www.apache.org/dyn/closer.cgi?path=/activemq/apache-activemq/5.9.0/apache-activemq ...

  9. ActiveMQ笔记:管理和监控

    ActiveMQ提供了比较丰富的监控和管理工具.在ActiveMQ的网页里(http://activemq.apache.org/how-can-i-monitor-activemq.html)提到了 ...

随机推荐

  1. 整数压缩编码 ZigZag

    在分析Avro源码时,发现Avro为了对int.long类型数据压缩,采用Protocol Buffers的ZigZag编码(Thrift也采用了ZigZag来压缩整数). 1. 补码编码 为了便于后 ...

  2. 8.2 使用Fluent API进行实体映射【Code-First系列】

    现在,我们来学习怎么使用Fluent API来配置实体. 一.配置默认的数据表Schema Student实体 using System; using System.Collections.Gener ...

  3. WinForm 代码实现以管理员身份运行

    [STAThread] static void Main(string[] Args) { //获得当前登录的Windows用户标示 System.Security.Principal.Windows ...

  4. c#获取光标在屏幕中位置

    需要调用win32api,winform.wpf通用 代码如下: [DllImport("user32.dll")] public static extern bool GetCu ...

  5. ASP.NET Core开发-如何配置Kestrel 网址Urls

    ASP.NET Core中如何配置Kestrel Urls呢,大家可能都知道使用UseUrls() 方法来配置. 今天给介绍全面的ASP.NET Core 配置 Urls,使用多种方式配置Urls. ...

  6. 学习笔记(二)——MVC扩展(渲染视图)

    如何渲染视图? 我以近乎的视图引擎为例总结了一下,近乎中的ThemedViewEngine类,就是重写后的的视图引擎.ThemedViewEngine类主要对FindPartialView和FindV ...

  7. Xamarin.ios引用第三方SDK

    引言 诚然,Xamarin是个优秀的跨平台解决方案,但毕竟还是不能将Native中所有的方法都直接实现.诸如各种第三方库,也都只有java/oc原生版本的SDK,无法直接拿过来直接使用.但,不能直接拿 ...

  8. php实现设计模式之 备忘录模式

    <?php /*备忘录模式:在不破坏封装的前提下,获取对象的内部状态,并且在对象外保存该状态.这样就可以将该对象恢复到保存之前的状态(行为模式) * * 发起人:记录当前时刻的内部状态,负责定义 ...

  9. Linux(二)__文件目录、常用命令

    一.linux下的文件目录 linux的文件系统是采用级层式的树状目录结构,在此结构中的最上层 是根目录"/",然后在此目录下再创建其他的目录 深刻理解linux文件目录是非常重要 ...

  10. Java基础学习 -- 接口

    interface是一种特殊的class 接口是纯抽象类 所有的成员函数都是抽象函数: 所有的成员变量都是public static final; 接口是为了方便类的调用 一个类如果要去实现某个接口, ...