Skip to main content
版本:v1.1.x

监控 Apache ActiveMQ 消息中间件

对 Apache ActiveMQ 消息中间件的运行状态,节点,Topic等相关指标进行监测。

使用协议:JMX

监控前操作

您需要在 ActiveMQ 开启 JMX 服务,HertzBeat 使用 JMX 协议对 ActiveMQ 进行指标采集。

  1. 修改安装目录下的 conf/activemq.xml 文件,开启JMX

broker 标签中添加 userJmx="true" 属性

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}" useJmx="true">
<!-- others -->
</broker>
  1. 修改安装目录下的 bin/env 文件,配置JMX 端口 IP等

将如下原配置信息

# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.port=11099"
# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_CONF}/jmx.password"
# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.access.file=${ACTIVEMQ_CONF}/jmx.access"
# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.ssl=false"

ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote"

更新为如下配置,⚠️注意修改本机对外IP

# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_CONF}/jmx.password"
# ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.access.file=${ACTIVEMQ_CONF}/jmx.access"

ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.port=11099"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.ssl=false"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.authenticate=false"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Djava.rmi.server.hostname=本机对外IP"

ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote"
  1. 重启 ACTIVEMQ 服务,在 HertzBeat 添加对应 ActiveMQ 监控即可,参数使用 JMX 配置的 IP 端口。

配置参数

参数名称参数帮助描述
监控Host被监控的对端IPV4,IPV6或域名。注意⚠️不带协议头(eg: https://, http://)。
监控名称标识此监控的名称,名称需要保证唯一性。
JMX端口JMX 对外提供的HTTP端口,默认为 11099。
JMX URL可选,自定义 JMX URL 连接
用户名认证时使用的用户名
密码认证时使用的密码
采集间隔监控周期性采集数据间隔时间,单位秒,可设置的最小间隔为30秒
是否探测新增监控前是否先探测检查监控可用性,探测成功才会继续新增修改操作
描述备注更多标识和描述此监控的备注信息,用户可以在这里备注信息

采集指标

指标集合:broker

指标名称指标单位指标帮助描述
BrokerNameThe name of the broker.
BrokerVersionThe version of the broker.
UptimeUptime of the broker.
UptimeMillismsUptime of the broker in milliseconds.
PersistentMessages are synchronized to disk.
MemoryPercentUsage%Percent of memory limit used.
StorePercentUsage%Percent of store limit used.
TempPercentUsage%Percent of temp limit used.
CurrentConnectionsCountAttribute exposed for management
TotalConnectionsCountAttribute exposed for management
TotalEnqueueCountNumber of messages that have been sent to the broker.
TotalDequeueCountNumber of messages that have been acknowledged on the broker.
TotalConsumerCountNumber of message consumers subscribed to destinations on the broker.
TotalProducerCountNumber of message producers active on destinations on the broker.
TotalMessageCountNumber of unacknowledged messages on the broker.
AverageMessageSizeAverage message size on this broker
MaxMessageSizeMax message size on this broker
MinMessageSizeMin message size on this broker

指标集合:topic

指标名称指标单位指标帮助描述
NameName of this destination.
MemoryLimitMBMemory limit, in bytes, used by undelivered messages before paging to temporary storage.
MemoryPercentUsageThe percentage of the memory limit used
ProducerCountNumber of producers attached to this destination
ConsumerCountNumber of consumers subscribed to this destination.
EnqueueCountNumber of messages that have been sent to the destination.
DequeueCountNumber of messages that has been acknowledged (and removed) from the destination.
ForwardCountNumber of messages that have been forwarded (to a networked broker) from the destination.
InFlightCountNumber of messages that have been dispatched to, but not acknowledged by, consumers.
DispatchCountNumber of messages that has been delivered to consumers, including those not acknowledged
ExpiredCountNumber of messages that have been expired.
StoreMessageSizeBThe memory size of all messages in this destination's store.
AverageEnqueueTimemsAverage time a message was held on this destination.
MaxEnqueueTimemsThe longest time a message was held on this destination
MinEnqueueTimemsThe shortest time a message was held on this destination
TotalBlockedTimemsTotal time (ms) messages have been blocked by flow control
AverageMessageSizeBAverage message size on this destination
MaxMessageSizeBMax message size on this destination
MinMessageSizeBMin message size on this destination

指标集合:memory_pool

指标名称指标单位指标帮助描述
name指标名称
committedkb总量
initkb初始化大小
maxkb最大
usedkb已使用

指标集合:class_loading

指标名称指标单位指标帮助描述
LoadedClassCount已加载类数量
TotalLoadedClassCount历史已加载类总量
UnloadedClassCount未加载类数量

指标集合:thread

指标名称指标单位指标帮助描述
TotalStartedThreadCount已经开始的线程数量
ThreadCount线程数
PeakThreadCount未加载类数量
DaemonThreadCount守护进程数
CurrentThreadUserTimems使用时间
CurrentThreadCpuTimems使用CPU时间