ActiveMQ
Installation Configuration¶
ActiveMQ Configuration¶
ActiveMQ is written in Java and supports exposing metrics through the jmx prometheus
plugin.
1.1 Download jmx-exporter¶
Download address: https://github.com/prometheus/jmx_exporter
1.2 Create ActiveMQ jmx Configuration¶
Add a jmx.yaml
file under the conf directory of ActiveMQ with the following content:
lowercaseOutputName: true
lowercaseOutputLabelNames: true
blacklistObjectNames:
- "org.apache.activemq:clientId=*,*"
whitelistObjectNames:
- "org.apache.activemq:destinationType=Queue,*"
- "org.apache.activemq:destinationType=Topic,*"
- "org.apache.activemq:type=Broker,brokerName=*"
- "org.apache.activemq:type=Topic,brokerName=*"
- "org.apache.activemq:type=Broker,brokerName=*,destinationType=Queue,destinationName=*,endpoint=*,clientId=*,consumerId=*"
- "org.apache.activemq:type=Broker,brokerName=*,destinationType=Topic,destinationName=*,endpoint=*,clientId=*,consumerId=*"
rules:
- pattern: org.apache.activemq:type=Broker,brokerName=(\S+),destinationType=(\S+),destinationName=(\S+),endpoint=(\S+),clientId=(\S+),consumerId=(\S+),?>(\w+)
name: "activemq_consumer_$7"
labels:
broker_name: "$1"
destination_type: "$2"
destination_name: "$3"
endpoint: "$4"
client_id: "$5"
consumer_id: "$6"
- pattern: org.apache.activemq<type=Broker, brokerName=(\S*), destinationType=Queue, destinationName=(\S*)><>(\w+)
name: activemq_queue_$3
attrNameSnakeCase: true
labels:
broker_name: "$1"
destination_name: "$2"
destination_type: "Queue"
- pattern: org.apache.activemq<type=Broker, brokerName=(\S*), destinationType=Topic, destinationName=(\S*)><>(\w+)
name: activemq_topic_$3
attrNameSnakeCase: true
labels:
broker_name: "$1"
destination_name: "$2"
destination_type: "Topic"
- pattern: org.apache.activemq<type=Broker, brokerName=(\S*)><>CurrentConnectionsCount
name: activemq_connections
type: GAUGE
labels:
broker_name: "$1"
connection_type: current
- pattern: org.apache.activemq<type=Broker, brokerName=(\S*)><>TotalConnectionsCount
name: activemq_connections
type: GAUGE
labels:
broker_name: "$1"
connection_type: total
- pattern: org.apache.activemq<type=Broker, brokerName=(\S*)><>Total(.*)Count
name: activemq_$2_total
type: COUNTER
labels:
broker_name: "$1"
- pattern: org.apache.activemq<type=Broker, brokerName=(\S*)><>(.*)PercentUsage
name: activemq_$2_usage_ratio
type: GAUGE
labels:
broker_name: "$1"
valueFactor: 0.01
1.3 Adjust Startup Parameters¶
In the bin directory of ActiveMQ, modify the setenv
file by adding the following content:
ACTIVEMQ_OPTS="-javaagent:${ACTIVEMQ_BASE}/jmx_prometheus_javaagent-1.2.0.jar=8081:${ACTIVEMQ_BASE}/conf/jmx.yaml"
The currently set port number is 8081
, which will be used for collection below. You can adjust it, but it must match the collection port.
1.4 Restart ActiveMQ¶
bin/activemq stop bin/activemq start
DataKit¶
Enable Collector¶
Enable the prometheus
collector to collect ActiveMQ metrics. Navigate to the DataKit installation directory under conf.d/prom
and execute the following command:
cp prom.conf.sample activemq.conf
Adjust the content of activemq.conf
, mainly focusing on the following adjustments:
- Restart
After making adjustments, restart DataKit
datakit service -R
Metrics¶
Metric Name | Description | Unit |
---|---|---|
connections |
The number of client connections currently established with the ActiveMQ Broker | Count |
consumer_total |
The cumulative number of consumers (Consumer) created | Count |
dequeue_total |
The total number of messages successfully consumed from all queues/topics | Count |
enqueue_total |
The total number of new messages received by all queues/topics | Count |
jobschedulerstore_usage_ratio |
The usage ratio of JobSchedulerStore, indicating the proportion of persistent task storage space occupied | Percentage (%) |
memory_usage_ratio |
The proportion of memory used by the ActiveMQ Broker relative to the configured upper limit | Percentage (%) |
message_total |
The total number of messages currently existing on the Broker (including pending and unacknowledged messages) | Count |
producer_total |
The cumulative number of message producers (Producer) created | Count |
queue_always_retroactive |
Indicates whether the queue has enabled the "always retroactive" feature, allowing new consumers to retrieve historical messages | Boolean value (0/1) |
queue_average_blocked_time |
The average time the queue is blocked due to insufficient resources | Milliseconds (ms) |
queue_average_enqueue_time |
The average time required for a message to enter the queue | Milliseconds (ms) |
queue_average_message_size |
The average byte size of messages in the queue | Bytes (B) |
queue_blocked_producer_warning_interval |
The warning interval time when the producer is blocked due to a full queue | Seconds (s) |
queue_blocked_sends |
The cumulative number of times producers have been blocked due to a full queue | Count |
queue_cache_enabled |
Indicates whether the current queue has enabled the caching mechanism | Boolean value (0/1) |
queue_consumer_count |
The number of consumers currently subscribed or listening to this queue | Count |
queue_cursor_full |
Indicates whether the queue's message cursor (Cursor) has reached its maximum capacity | Boolean value (0/1) |
queue_cursor_memory_usage |
The amount of memory used by the queue cursor | Bytes (B) |
queue_cursor_percent_usage |
The proportion of queue cursor memory usage relative to the total allocated memory | Percentage (%) |
queue_dequeue_count |
The number of messages successfully consumed from this queue | Count |
queue_dispatch_count |
The cumulative number of messages that have been attempted to dispatch to consumers | Count |
queue_dlq |
The number of messages transferred to the dead letter queue (DLQ) | Count |
queue_duplicate_from_store_count |
The number of times messages are redundantly read from persistent storage due to network or other issues | Count |
queue_enqueue_count |
The number of messages added to this queue | Count |
queue_expired_count |
The number of messages expired due to TTL settings | Count |
queue_forward_count |
The cumulative number of times this queue forwards messages to other destinations | Count |
queue_in_flight_count |
The number of messages being processed by consumers but not yet confirmed | Count |
queue_max_audit_depth |
The maximum number of entries recorded during duplicate message auditing | Count |
queue_max_enqueue_time |
The maximum time required for a message to enter the queue | Milliseconds (ms) |
queue_max_message_size |
The maximum byte size of a single message in the queue | Bytes (B) |
queue_max_page_size |
The maximum page size when loading messages in pages | Count |
queue_max_producers_to_audit |
The maximum number of producers that can be tracked and used for duplicate checks | Count |
queue_memory_limit |
The maximum amount of memory allocated by this queue for message storage | Bytes (B) |
queue_memory_percent_usage |
The proportion of current queue memory usage relative to the configured upper limit | Percentage (%) |
queue_memory_usage_byte_count |
The actual amount of memory currently occupied by the queue | Bytes (B) |
queue_memory_usage_portion |
The proportion of overall memory usage taken up by the queue | Floating point number (0~1) |
queue_min_enqueue_time |
The minimum time required for a message to enter the queue | Milliseconds (ms) |
queue_min_message_size |
The minimum byte size of a single message in the queue | Bytes (B) |
queue_paused |
Indicates whether the queue is in a paused state | Boolean value (0/1) |
queue_prioritized_messages |
Indicates whether the message priority sorting feature is enabled | Boolean value (0/1) |
queue_producer_count |
The number of producers currently sending messages to this queue | Count |
queue_producer_flow_control |
Whether producer flow control is enabled | Boolean value (0/1) |
queue_queue_size |
The total number of messages waiting to be consumed in the current queue | Count |
queue_send_duplicate_from_store_to_dlq |
The number of redundant messages sent from persistent storage to the dead letter queue | Count |
queue_store_message_size |
The total size of all messages in the queue within persistent storage | Bytes (B) |
queue_temp_usage_limit |
The maximum limit of temporary message storage for the queue | Bytes (B) |
queue_temp_usage_percent_usage |
The proportion of queue temporary storage usage relative to the configured upper limit | Percentage (%) |
queue_total_blocked_time |
The cumulative blocking time of the queue due to insufficient resources | Milliseconds (ms) |
queue_use_cache |
Indicates whether the queue has enabled the caching mechanism | Boolean value (0/1) |
store_usage_ratio |
The usage ratio of the main message storage (such as file systems or databases) | Percentage (%) |
temp_usage_ratio |
The usage ratio of temporary message storage | Percentage (%) |
topic_always_retroactive |
Indicates whether the topic has enabled the "always retroactive" feature, allowing new consumers to retrieve historical messages | Boolean value (0/1) |
topic_average_blocked_time |
The average time the topic is blocked due to insufficient resources | Milliseconds (ms) |
topic_average_enqueue_time |
The average time required for a message to enter the topic | Milliseconds (ms) |
topic_average_message_size |
The average byte size of messages in the topic | Bytes (B) |
topic_blocked_producer_warning_interval |
The warning interval time when the producer is blocked due to a full topic | Seconds (s) |
topic_blocked_sends |
The cumulative number of times producers have been blocked due to a full topic | Count |
topic_cache_enabled |
Indicates whether the current topic has enabled the caching mechanism | Boolean value (0/1) |
topic_consumer_count |
The number of consumers currently subscribed or listening to this topic | Count |
topic_cursor_full |
Indicates whether the topic's message cursor (Cursor) has reached its maximum capacity | Boolean value (0/1) |
topic_cursor_memory_usage |
The amount of memory used by the topic cursor | Bytes (B) |
topic_cursor_percent_usage |
The proportion of topic cursor memory usage relative to the total allocated memory | Percentage (%) |
topic_dequeue_count |
The number of messages successfully consumed from this topic | Count |
topic_dispatch_count |
The cumulative number of messages that have been attempted to dispatch to consumers | Count |
topic_dlq |
The number of messages transferred to the dead letter topic (DLQ) | Count |
topic_duplicate_from_store_count |
The number of times messages are redundantly read from persistent storage due to network or other issues | Count |
topic_enqueue_count |
The number of messages added to this topic | Count |
topic_expired_count |
The number of messages expired due to TTL settings | Count |
topic_forward_count |
The cumulative number of times this topic forwards messages to other destinations | Count |
topic_in_flight_count |
The number of messages being processed by consumers but not yet confirmed | Count |
topic_max_audit_depth |
The maximum number of entries recorded during duplicate message auditing | Count |
topic_max_enqueue_time |
The maximum time required for a message to enter the topic | Milliseconds (ms) |
topic_max_message_size |
The maximum byte size of a single message in the topic | Bytes (B) |
topic_max_page_size |
The maximum page size when loading messages in pages | Count |
topic_max_producers_to_audit |
The maximum number of producers that can be tracked and used for duplicate checks | Count |
topic_memory_limit |
The maximum amount of memory allocated by this topic for message storage | Bytes (B) |
topic_memory_percent_usage |
The proportion of current topic memory usage relative to the configured upper limit | Percentage (%) |
topic_memory_usage_byte_count |
The actual amount of memory currently occupied by the topic | Bytes (B) |
topic_memory_usage_portion |
The proportion of overall memory usage taken up by the topic | Floating point number (0~1) |
topic_min_enqueue_time |
The minimum time required for a message to enter the topic | Milliseconds (ms) |
topic_min_message_size |
The minimum byte size of a single message in the topic | Bytes (B) |
topic_prioritized_messages |
Indicates whether the message priority sorting feature is enabled | Boolean value (0/1) |
topic_producer_count |
The number of producers currently sending messages to this topic | Count |
topic_producer_flow_control |
Whether producer flow control is enabled | Boolean value (0/1) |
topic_queue_size |
The total number of messages waiting to be consumed in the current topic | Count |
topic_send_duplicate_from_store_to_dlq |
The number of redundant messages sent from persistent storage to the dead letter topic | Count |
topic_store_message_size |
The total size of all messages in the topic within persistent storage | Bytes (B) |
topic_temp_usage_limit |
The maximum limit of temporary message storage for the topic | Bytes (B) |
topic_temp_usage_percent_usage |
The proportion of topic temporary storage usage relative to the configured upper limit | Percentage (%) |
topic_total_blocked_time |
The cumulative blocking time of the topic due to insufficient resources | Milliseconds (ms) |
topic_use_cache |
Indicates whether the topic has enabled the caching mechanism | Boolean value (0/1) |