So we recently migrated from ActiveMQ "Classic" to ActiveMQ Artemis and it seems like we are unable to get our Telegraf configuration right for inputs.jolokia2_agent
.
[[inputs.jolokia2_agent]]
urls = [ "http://<artemis-live-instance>:8161/console/jolokia/", "http://<artemis-backup-instance>:8161/console/jolokia/" ]
username = "<user>"
password = "<password>"
[[inputs.jolokia2_agent.metric]]
name = "artemis"
mbean = "org.apache.activemq.artemis:type=Broker,brokerName=*,destinationType=*,destinationName=<destination-root>.*"
paths = [ "AverageEnqueueTime", "AverageMessageSize", "BlockedSends", "ConsumerCount", "DequeueCount", "DispatchCount", "EnqueueCount", "ExpiredCount", "ForwardCount", "InFlightCount", "MaxEnqueueTime", "MemoryPercentUsage", "MemoryUsageByteCount", "MinEnqueueTime", "ProducerCount", "QueueSize", "StoreMessageSize" ]
tag_keys = [ "destinationName", "destinationType" ]
[[inputs.jolokia2_agent.metric]]
name = "artemis"
mbean = "org.apache.activemq.artemis:type=Broker,brokerName=*,destinationType=Queue,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" ]
We are heavily using Grafana so it's pretty important to get metrics for ActiveMQ Artemis.
Couldn't find any examples from Telegraf documentation but I was able to figure it out using this answer.
[[inputs.jolokia2_agent]]
urls = [ "http://<artemis-live-instance>:8161/console/jolokia/", "http://<artemis-backup-instance>:8161/console/jolokia/" ]
username = "<user>"
password = "<password>"
[[inputs.jolokia2_agent.metric]]
name = "artemis"
mbean = "org.apache.activemq.artemis:broker=\"*\",component=addresses,address=\"<queue-prefix>.*\",subcomponent=queues,routing-type=\"anycast\",queue=\"<queue-prefix>.*\""
tag_keys = ["queue", "subcomponent"]
Another problem occured - as you can see I've converted queue names into tags but they are stored with double quotes around them. For example: "example.queue.name" should be just example.queue.name (without double quotes).
As double quotes are not trimmed by default I had to use a bit of a workaround.
[[processors.strings]]
namepass = ["artemis"]
[[processors.strings.trim]]
tag = "queue"
cutset = '"'