跳到主要内容
版本:1.6.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>
  2. 修改安装目录下的 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"
  3. 重启 ACTIVEMQ 服务,在 HertzBeat 添加对应 ActiveMQ 监控即可,参数使用 JMX 配置的 IP 端口。

配置参数​

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

采集指标​

指标集合:broker​

指标名称指标单位指标帮助描述
BrokerName无The name of the broker.
BrokerVersion无The version of the broker.
Uptime无Uptime of the broker.
UptimeMillismsUptime of the broker in milliseconds.
Persistent无Messages are synchronized to disk.
MemoryPercentUsage%Percent of memory limit used.
StorePercentUsage%Percent of store limit used.
TempPercentUsage%Percent of temp limit used.
CurrentConnectionsCount无Attribute exposed for management
TotalConnectionsCount无Attribute exposed for management
TotalEnqueueCount无Number of messages that have been sent to the broker.
TotalDequeueCount无Number of messages that have been acknowledged on the broker.
TotalConsumerCount无Number of message consumers subscribed to destinations on the broker.
TotalProducerCount无Number of message producers active on destinations on the broker.
TotalMessageCount无Number of unacknowledged messages on the broker.
AverageMessageSize无Average message size on this broker
MaxMessageSize无Max message size on this broker
MinMessageSize无Min message size on this broker

指标集合:topic​

指标名称指标单位指标帮助描述
Name无Name of this destination.
MemoryLimitMBMemory limit, in bytes, used by undelivered messages before paging to temporary storage.
MemoryPercentUsage无The percentage of the memory limit used
ProducerCount无Number of producers attached to this destination
ConsumerCount无Number of consumers subscribed to this destination.
EnqueueCount无Number of messages that have been sent to the destination.
DequeueCount无Number of messages that has been acknowledged (and removed) from the destination.
ForwardCount无Number of messages that have been forwarded (to a networked broker) from the destination.
InFlightCount无Number of messages that have been dispatched to, but not acknowledged by, consumers.
DispatchCount无Number of messages that has been delivered to consumers, including those not acknowledged
ExpiredCount无Number 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时间