콘텐츠로 이동

ActiveMQ

설치 및 설정

ActiveMQ 설정

ActiveMQ는 Java로 작성되었으며, jmx prometheus 플러그인을 통해 메트릭을 노출할 수 있습니다.

1.1 jmx-exporter 다운로드

다운로드 주소: https://github.com/prometheus/jmx_exporter

1.2 ActiveMQ jmx 설정 추가

ActiveMQ의 conf 디렉터리 아래에 jmx.yaml 파일을 새로 추가하고, 내용은 다음과 같습니다.

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 시작 파라미터 조정

ActiveMQ의 bin 디렉터리 아래에서 setenv 파일을 수정하고, 다음 내용을 추가합니다.

ACTIVEMQ_OPTS="-javaagent:${ACTIVEMQ_BASE}/jmx_prometheus_javaagent-1.2.0.jar=8081:${ACTIVEMQ_BASE}/conf/jmx.yaml"

현재 설정된 포트 번호는 8081이며, 아래 수집에서 사용합니다. 필요에 따라 조정할 수 있지만, 수집 포트와 일치해야 합니다.

1.4 ActiveMQ 재시작

bin/activemq stop bin/activemq start

DataKit

수집기 활성화

prometheus 수집기를 활성화해 ActiveMQ의 메트릭을 수집합니다. DataKit 설치 디렉터리conf.d/samples로 이동한 뒤 아래 명령을 실행합니다.

cp prom.conf.sample activemq.conf

activemq.conf 내용을 조정합니다. 주로 아래 내용을 수정합니다.

[[inputs.prom]]
  ## Exporter URLs.
  urls = ["http://localhost:8081/metrics"]
  source = "activemq"
  ...
  • 재시작

조정이 끝나면 Datakit을 재시작합니다.

datakit service -R

메트릭

메트릭 이름 설명 단위
connections 현재 ActiveMQ Broker와 연결된 클라이언트 연결 수
consumer_total 누적 생성된 Consumer 수
dequeue_total 모든 큐/토픽에서 성공적으로 소비된 메시지 총수
enqueue_total 모든 큐/토픽에서 수신한 새 메시지 총수
jobschedulerstore_usage_ratio JobSchedulerStore 사용 비율로, 영구 작업 저장 공간의 점유율을 나타냅니다 퍼센트(%)
memory_usage_ratio ActiveMQ Broker가 사용하는 메모리가 설정 상한에서 차지하는 비율 퍼센트(%)
message_total 현재 Broker에 존재하는 모든 메시지 수(처리 대기 및 미확인 메시지 포함)
producer_total 누적 생성된 메시지 Producer 수
queue_always_retroactive 이 큐가 “항상 과거 조회” 기능을 사용 중인지 여부로, 새 소비자가 과거 메시지를 가져올 수 있게 합니다 불리언 값(0/1)
queue_average_blocked_time 큐가 자원 부족으로 차단된 시간의 평균값 밀리초(ms)
queue_average_enqueue_time 메시지가 큐에 들어가는 데 걸리는 평균 시간 밀리초(ms)
queue_average_message_size 큐 내 메시지의 평균 바이트 크기 바이트(B)
queue_blocked_producer_warning_interval Producer가 큐가 가득 차 차단될 때의 경고 간격 시간 초(s)
queue_blocked_sends 큐가 가득 차 Producer가 차단된 누적 횟수
queue_cache_enabled 현재 큐에서 캐시 메커니즘을 사용 중인지 여부 불리언 값(0/1)
queue_consumer_count 현재 이 큐를 구독하거나 리슨하는 Consumer 수
queue_cursor_full 큐의 메시지 커서(Cursor)가 최대 용량에 도달했는지 여부 불리언 값(0/1)
queue_cursor_memory_usage 큐 커서가 사용하는 메모리량 바이트(B)
queue_cursor_percent_usage 큐 커서 메모리 사용량이 총 할당 메모리에서 차지하는 비율 퍼센트(%)
queue_dequeue_count 이 큐에서 성공적으로 소비된 메시지 수
queue_dispatch_count Consumer에게 전달을 시도한 누적 메시지 수
queue_dlq 데드레터 큐(DLQ)로 이동된 메시지 수
queue_duplicate_from_store_count 네트워크 또는 기타 문제로 인해 영구 저장소에서 중복으로 읽힌 횟수
queue_enqueue_count 이 큐에 추가된 메시지 수
queue_expired_count TTL 설정으로 만료된 메시지 수
queue_forward_count 이 큐가 메시지를 다른 목적지로 전달한 누적 횟수
queue_in_flight_count 현재 Consumer가 처리 중이지만 아직 확인되지 않은 메시지 수
queue_max_audit_depth 중복 메시지 감사 시 기록할 수 있는 최대 항목 수
queue_max_enqueue_time 메시지가 큐에 들어가는 데 걸리는 최대 시간 밀리초(ms)
queue_max_message_size 큐 내 단일 메시지의 최대 바이트 크기 바이트(B)
queue_max_page_size 페이지 단위로 메시지를 불러올 때의 최대 페이지 크기
queue_max_producers_to_audit 추적 및 중복 검사에 사용할 수 있는 Producer의 최대 수
queue_memory_limit 이 큐에 메시지 저장을 위해 할당된 최대 메모리 바이트(B)
queue_memory_percent_usage 큐의 현재 메모리 사용량이 설정 상한에서 차지하는 비율 퍼센트(%)
queue_memory_usage_byte_count 큐가 현재 실제로 사용 중인 메모리 크기 바이트(B)
queue_memory_usage_portion 큐가 전체 메모리 사용에서 차지하는 비중 실수(0~1)
queue_min_enqueue_time 메시지가 큐에 들어가는 데 걸리는 최소 시간 밀리초(ms)
queue_min_message_size 큐 내 단일 메시지의 최소 바이트 크기 바이트(B)
queue_paused 이 큐가 일시 중지 상태인지 여부 불리언 값(0/1)
queue_prioritized_messages 메시지 우선순위 정렬 기능을 사용하는지 여부 불리언 값(0/1)
queue_producer_count 현재 이 큐로 메시지를 보내는 Producer 수
queue_producer_flow_control Producer 흐름 제어를 사용 중인지 여부 불리언 값(0/1)
queue_queue_size 현재 큐에서 소비 대기 중인 메시지 총수
queue_send_duplicate_from_store_to_dlq 영구 저장소에서 데드레터 큐로 전송된 중복 메시지 수
queue_store_message_size 큐의 모든 메시지가 영구 저장소에서 차지하는 총 크기 바이트(B)
queue_temp_usage_limit 큐 임시 메시지 저장의 최대 제한 바이트(B)
queue_temp_usage_percent_usage 큐 임시 저장소 사용량이 설정 상한에서 차지하는 비율 퍼센트(%)
queue_total_blocked_time 큐가 자원 부족으로 인해 누적 차단된 시간 밀리초(ms)
queue_use_cache 이 큐가 캐시 메커니즘을 사용 중인지 여부 불리언 값(0/1)
store_usage_ratio 주 메시지 저장소(예: 파일 시스템 또는 데이터베이스)의 사용 비율 퍼센트(%)
temp_usage_ratio 임시 메시지 저장소의 사용 비율 퍼센트(%)
topic_always_retroactive 이 토픽이 “항상 과거 조회” 기능을 사용 중인지 여부로, 새 소비자가 과거 메시지를 가져올 수 있게 합니다 불리언 값(0/1)
topic_average_blocked_time 토픽이 자원 부족으로 차단된 시간의 평균값 밀리초(ms)
topic_average_enqueue_time 메시지가 토픽에 들어가는 데 걸리는 평균 시간 밀리초(ms)
topic_average_message_size 토픽 내 메시지의 평균 바이트 크기 바이트(B)
topic_blocked_producer_warning_interval Producer가 토픽이 가득 차 차단될 때의 경고 간격 시간 초(s)
topic_blocked_sends 토픽이 가득 차 Producer가 차단된 누적 횟수
topic_cache_enabled 현재 토픽에서 캐시 메커니즘을 사용 중인지 여부 불리언 값(0/1)
topic_consumer_count 현재 이 토픽을 구독하거나 리슨하는 Consumer 수
topic_cursor_full 토픽의 메시지 커서(Cursor)가 최대 용량에 도달했는지 여부 불리언 값(0/1)
topic_cursor_memory_usage 토픽 커서가 사용하는 메모리량 바이트(B)
topic_cursor_percent_usage 토픽 커서 메모리 사용량이 총 할당 메모리에서 차지하는 비율 퍼센트(%)
topic_dequeue_count 이 토픽에서 성공적으로 소비된 메시지 수
topic_dispatch_count Consumer에게 전달을 시도한 누적 메시지 수
topic_dlq 데드레터 토픽(DLQ)으로 이동된 메시지 수
topic_duplicate_from_store_count 네트워크 또는 기타 문제로 인해 영구 저장소에서 중복으로 읽힌 횟수
topic_enqueue_count 이 토픽에 추가된 메시지 수
topic_expired_count TTL 설정으로 만료된 메시지 수
topic_forward_count 이 토픽이 메시지를 다른 목적지로 전달한 누적 횟수
topic_in_flight_count 현재 Consumer가 처리 중이지만 아직 확인되지 않은 메시지 수
topic_max_audit_depth 중복 메시지 감사 시 기록할 수 있는 최대 항목 수
topic_max_enqueue_time 메시지가 토픽에 들어가는 데 걸리는 최대 시간 밀리초(ms)
topic_max_message_size 토픽 내 단일 메시지의 최대 바이트 크기 바이트(B)
topic_max_page_size 페이지 단위로 메시지를 불러올 때의 최대 페이지 크기
topic_max_producers_to_audit 추적 및 중복 검사에 사용할 수 있는 Producer의 최대 수
topic_memory_limit 이 토픽에 메시지 저장을 위해 할당된 최대 메모리 바이트(B)
topic_memory_percent_usage 토픽의 현재 메모리 사용량이 설정 상한에서 차지하는 비율 퍼센트(%)
topic_memory_usage_byte_count 토픽이 현재 실제로 사용 중인 메모리 크기 바이트(B)
topic_memory_usage_portion 토픽이 전체 메모리 사용에서 차지하는 비중 실수(0~1)
topic_min_enqueue_time 메시지가 토픽에 들어가는 데 걸리는 최소 시간 밀리초(ms)
topic_min_message_size 토픽 내 단일 메시지의 최소 바이트 크기 바이트(B)
topic_prioritized_messages 메시지 우선순위 정렬 기능을 사용하는지 여부 불리언 값(0/1)
topic_producer_count 현재 이 토픽으로 메시지를 보내는 Producer 수
topic_producer_flow_control Producer 흐름 제어를 사용 중인지 여부 불리언 값(0/1)
topic_queue_size 현재 토픽에서 소비 대기 중인 메시지 총수
topic_send_duplicate_from_store_to_dlq 영구 저장소에서 데드레터 토픽으로 전송된 중복 메시지 수
topic_store_message_size 토픽의 모든 메시지가 영구 저장소에서 차지하는 총 크기 바이트(B)
topic_temp_usage_limit 토픽 임시 메시지 저장의 최대 제한 바이트(B)
topic_temp_usage_percent_usage 토픽 임시 저장소 사용량이 설정 상한에서 차지하는 비율 퍼센트(%)
topic_total_blocked_time 토픽이 자원 부족으로 인해 누적 차단된 시간 밀리초(ms)
topic_use_cache 이 토픽이 캐시 메커니즘을 사용 중인지 여부 불리언 값(0/1)

문서 평가

이 페이지가 도움이 되었나요?