Skip to main content
Version: v1.6.x

Monitoring Apache ActiveMQ

Monitoring the running status of Apache ActiveMQ message middleware, nodes, topics and other related metrics.

Use Protocol: JMX

Pre-monitoring Operations

You need to enable the JMX service on ActiveMQ, HertzBeat uses the JMX protocol to collect metrics from ActiveMQ.

  1. Modify the conf/activemq.xml file in the installation directory to enable JMX

    Add userJmx="true" attribute in broker tag

    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}" useJmx="true">
    <!-- others -->
    </broker>
  2. Modify the bin/env file in the installation directory, configure the JMX port IP, etc.

    The original configuration information will be as follows

    # 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"

    Update to the following configuration, ⚠️ pay attention to modify local external 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. Restart the ACTIVEMQ service, and add the corresponding ActiveMQ monitoring in HertzBeat. The parameters use the IP port configured by JMX.

Configuration parameters

Parameter nameParameter help description
Monitoring HostThe peer IPV4, IPV6 or domain name to be monitored. Note ⚠️Without protocol header (eg: https://, http://).
Monitoring nameThe name that identifies this monitoring, and the name needs to be unique.
JMX portThe HTTP port provided by JMX, the default is 11099.
JMX URLOptional, customize the JMX URL connection
UsernameUsername used for authentication
passwordpassword used for authentication
Acquisition IntervalInterval time for monitoring periodic data collection, in seconds, the minimum interval that can be set is 30 seconds
Whether to detectWhether to detect and check the availability of monitoring before adding monitoring, and the operation of adding and modifying will continue after the detection is successful
Description RemarksMore remark information to identify and describe this monitoring, users can remark information here

Collect Metrics

metrics: broker

Metric NameUnitDescription
BrokerNameNoneThe name of the broker.
BrokerVersionNoneThe version of the broker.
UptimeNoneUptime of the broker.
UptimeMillismsUptime of the broker in milliseconds.
PersistentNoneMessages are synchronized to disk.
MemoryPercentUsage%Percent of memory limit used.
StorePercentUsage%Percent of store limit used.
TempPercentUsage%Percent of temp limit used.
CurrentConnectionsCountNoneAttribute exposed for management
TotalConnectionsCountNoneAttribute exposed for management
TotalEnqueueCountNoneNumber of messages that have been sent to the broker.
TotalDequeueCountNoneNumber of messages that have been acknowledged on the broker.
TotalConsumerCountNoneNumber of message consumers subscribed to destinations on the broker.
TotalProducerCountNoneNumber of message producers active on destinations on the broker.
TotalMessageCountNoneNumber of unacknowledged messages on the broker.
AverageMessageSizeNoneAverage message size on this broker
MaxMessageSizeNoneMax message size on this broker
MinMessageSizeNoneMin message size on this broker

metrics: topic

Metric NameUnitDescription
NameNoneName of this destination.
MemoryLimitMBMemory limit, in bytes, used by undelivered messages before paging to temporary storage.
MemoryPercentUsageNoneThe percentage of the memory limit used
ProducerCountNoneNumber of producers attached to this destination
ConsumerCountNoneNumber of consumers subscribed to this destination.
EnqueueCountNoneNumber of messages that have been sent to the destination.
DequeueCountNoneNumber of messages that has been acknowledged (and removed) from the destination.
ForwardCountNoneNumber of messages that have been forwarded (to a networked broker) from the destination.
InFlightCountNoneNumber of messages that have been dispatched to, but not acknowledged by, consumers.
DispatchCountNoneNumber of messages that has been delivered to consumers, including those not acknowledged
ExpiredCountNoneNumber 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

metrics: memory_pool

Metric NameUnitDescription
namemetrics name
committedkbtotal size
initkbinit size
maxkbmax size
usedkbused size

metrics: class_loading

Metric NameUnitDescription
LoadedClassCountLoaded Class Count
TotalLoadedClassCountTotal Loaded Class Count
UnloadedClassCountUnloaded Class Count

metrics: thread

Metric NameUnitDescription
TotalStartedThreadCountTotal Started Thread Count
ThreadCountThread Count
PeakThreadCountPeak Thread Count
DaemonThreadCountDaemon Thread Count
CurrentThreadUserTimemsCurrent Thread User Time
CurrentThreadCpuTimemsCurrent Thread Cpu Time