You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

迁移至ActiveMQ Artemis后,Telegraf jolokia2_agent指标采集配置求助

ActiveMQ Artemis 与 Telegraf Jolokia2_Agent 指标采集配置修复方案

现有配置核心问题

  • Jolokia端点路径错误:ActiveMQ Artemis默认独立Jolokia端点为/jolokia,而非控制台内嵌的/console/jolokia/,后者仅用于控制台页面,稳定性不足
  • MBean通配符使用错误:Jolokia的MBean匹配通配符为*(匹配任意字符),而非正则式的.*,原配置中destinationName=<destination-root>.*无法正确匹配目标队列
  • 重复配置冗余:DLQ的采集规则可合并至通用规则,无需单独定义
  • 认证类型未明确:部分Telegraf版本需显式声明auth_type = "basic"才能正确传递用户名密码

修复后的完整配置

[[inputs.jolokia2_agent]]
  # 修正Jolokia端点路径
  urls = [ "http://<artemis-live-instance>:8161/jolokia", "http://<artemis-backup-instance>:8161/jolokia" ]
  username = "<user>"
  password = "<password>"
  # 显式声明基础认证类型
  auth_type = "basic"

  [[inputs.jolokia2_agent.metric]]
    name  = "artemis"
    # 修正通配符,合并DLQ匹配规则
    mbean = "org.apache.activemq.artemis:type=Broker,brokerName=*,destinationType=*,destinationName=<destination-root>*,destinationName=ActiveMQ.DLQ"
    paths = [ "AverageEnqueueTime", "AverageMessageSize", "BlockedSends", "ConsumerCount", "DequeueCount", "DispatchCount", "EnqueueCount", "ExpiredCount", "ForwardCount", "InFlightCount", "MaxEnqueueTime", "MemoryPercentUsage", "MemoryUsageByteCount", "MinEnqueueTime", "ProducerCount", "QueueSize", "StoreMessageSize" ]
    tag_keys = [ "destinationName", "destinationType", "brokerName" ]
    # 可选:添加实例标签区分主备节点
    tags = { instance = "live" }

# 备份节点单独配置(可选,若要明确区分主备标签)
[[inputs.jolokia2_agent]]
  urls = [ "http://<artemis-backup-instance>:8161/jolokia" ]
  username = "<user>"
  password = "<password>"
  auth_type = "basic"

  [[inputs.jolokia2_agent.metric]]
    name  = "artemis"
    mbean = "org.apache.activemq.artemis:type=Broker,brokerName=*,destinationType=*,destinationName=<destination-root>*,destinationName=ActiveMQ.DLQ"
    paths = [ "AverageEnqueueTime", "AverageMessageSize", "BlockedSends", "ConsumerCount", "DequeueCount", "DispatchCount", "EnqueueCount", "ExpiredCount", "ForwardCount", "InFlightCount", "MaxEnqueueTime", "MemoryPercentUsage", "MemoryUsageByteCount", "MinEnqueueTime", "ProducerCount", "QueueSize", "StoreMessageSize" ]
    tag_keys = [ "destinationName", "destinationType", "brokerName" ]
    tags = { instance = "backup" }

额外验证与配置检查

  • 测试Jolokia连通性:用curl验证端点是否正常返回数据
    curl -u <user>:<password> http://<artemis-host>:8161/jolokia/read/org.apache.activemq.artemis:type=Broker,brokerName=*,destinationType=Queue,destinationName=*
    
  • Artemis管理配置检查:确保broker.xml中已启用management模块
    <management-module>
      <management-notifications>true</management-notifications>
      <journal-size-limit>10485760</journal-size-limit>
      <address-size-limit>10485760</address-size-limit>
    </management-module>
    
  • Jolokia访问控制:若存在jolokia-access.xml,需允许Telegraf所在IP访问,添加如下规则
    <allow-origin>*</allow-origin>
    <allow-host>telegraf-ip-address</allow-host>
    

内容的提问来源于stack exchange,提问作者Ivalo Pajumets

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 02:59:56