打开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. 一台电脑上的git同时使用两个github账户

    需求: 公司有github账号,自己有github账号,想在git上同时使用,两者互不干扰. 思路: 管理两个SHH key. 解决方案: 一.生成两个SSH key 为了举例方便,这里使用“one” ...

  2. 【知识积累】使用Httpclient实现网页的爬取并保存至本地

    程序功能实现了爬取网页页面并且将结果保存到本地,通过以爬取页面出发,做一个小的爬虫,分析出有利于自己的信息,做定制化的处理. 其中需要的http*的jar文件,可以在网上自行下载 import jav ...

  3. springmvc原理

    今天面试碰到一个特别恶心的公司面试官.是一个金融公司,过去后告诉我2点上班,带我去见经理.经理找人面试,看起来没有hr,经理直接看简历招人.经理上来就问我是xxx大学的,我说是,然后等面试官.面试官来 ...

  4. iOS通过ARC管理内存(内容根据iOS编程编写)

    栈 当程序执行某个方法(或函数)时,会从内存中一个叫栈的区域分配一块内存空间,这块内存空间我们叫帧.帧负责保护程序在方法内声明的变量的值.在方法内声明的变量我们称之为局部变量. 当我们的程序开始启动, ...

  5. git学习之branch分支

    作为新手,站在我的角度肤浅的来理解,分支就是相当于开辟了一个新的临时工作区,在这个工作区进行文件代码改动,然后在合并到master主工作区,这样能保证主工作区的安全性和稳定性,对于团队协作尤为重要. ...

  6. IIS 配置Http重定向到Https

    注意首先要安装url重定向模块    https://www.microsoft.com/zh-CN/download/details.aspx?id=7435 然后在web.config末尾添加如下 ...

  7. MessageBox的常用方法

    一 函数原型及参数 function MessageBox(hWnd: HWND; Text, Caption: PChar; Type: Word): Integer; hWnd:对话框父窗口句柄, ...

  8. error C2664: 'BOOL (PCERT_SELECT_STRUCT_A)' : cannot convert parameter 1 from 'CERT_SELECT_STRUCT *' to 'PCERT_SELECT_STRUCT_A'

    1. 编译c++程序出现标题所示错误 2. 解决方法:更改编码设置

  9. Verilog学习笔记简单功能实现(二)...............全加器

    先以一位全加器为例:Xi.Yi代表两个加数,Cin是地位进位信号,Cout是向高位的进位信号.列表有:   Xi     Yi    Cin Sum Cout 0 0 0 0 0 0 0 1 1 0 ...

  10. 程序员用HTML5给女朋友制作的3D相册

    程序员给女朋友用HTML5制作的3D相册,使用鼠标拖拽,能看到3D旋转效果,点击相片,相片能放大,移近.程序员发挥自己的专长,这是那些不懂编程的人望尘莫及的.本相册使用了HTML5的画布技术,需要谷歌 ...