influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.59k stars 5.56k forks source link

MQTT consumer plugin connected to ActiveMQ Artemis broker but no subscriptions created #9736

Closed jenrg closed 11 months ago

jenrg commented 3 years ago

Seems like Telegraf MQTT Consumer Input Plugin does not actually subscribe to any topic when connecting to ActiveMQ Artemis broker.

I'm using ActiveMQ Artemis as MQTT broker and successfully receiving messages from a producer to a topic (or in case of Artemis, an address with multicast routing). I tested subscribing and receiving messages successfully with a simple Python script using paho-mqtt (see attached gists for script source and Artemis logs) so the broker does work exactly as expected. Subscription queues are created and messages flow correctly.

Now I installed Telegraf and tried to consume the same topic with same QoS, same user etc. but the broker does not even receive the subscription event from Telegraf MQTT Consumer Input Plugin, not to mention any messages. The connection is established successfully and the plugin creates 2 sessions and pings the broker every now and then but it does not actually subscribe to the configured topic.

Relevant telegraf.conf:

[[inputs.mqtt_consumer]]
   servers = ["tcp://localhost:1883"]
   topics = [
     "topic/test",
   ]
   topic_tag = "topic"
   qos = 1
   max_undelivered_messages = 100
   persistent_session = false
   client_id = "telegraf"
   username = "user"
   password = "pass"
   data_format = "influx"

System info:

OS: Ubuntu 20.04.3 LTS Telegraf: 1.19.3-1 from https://repos.influxdata.com/ubuntu focal stable ActiveMQ Artemis: 2.18.0

Steps to reproduce:

  1. install ActiveMQ Artemis with default settings
  2. set up some MQTT client producing messages to a topic (or do this manually through Artemis UI)
  3. install Telegraf
  4. configure MQTT Consumer Input Plugin (see config above)
  5. restart Telegraf

Expected behavior:

Telegraf MQTT Consumer Input Plugin creates a durable subscription on the topic and starts receiving messages

Actual behavior:

Telegraf MQTT Consumer Input Plugin does NOT create any subscriptions and thus does not receive any messages

Additional info:

Python script used to successfully test topic subscription on the target broker https://gist.github.com/jenrg/e2631f0cc6f4adb2ebec2056276dfca1

ActiveMQ Artemis log from successful subscription by the Python script https://gist.github.com/jenrg/7877ba9c9d0149345fc7b7985bed5889

Telegraf log output https://gist.github.com/jenrg/d9722c053ff2aa327116b8a4e573e54f

ActiveMQ Artemis log from Telegraf connection created but no subscriptions https://gist.github.com/jenrg/df180b761af1c993eaf2391c3c376734

reimda commented 2 years ago

Hi @jenrg were you able to find a way to get this working? I noticed that Artemis was mentioned in #7735 as possibly working with Telegraf.

If not, are you able to contribute a PR to fix the issue? Thanks!

jenrg commented 2 years ago

No I didn't. I actually switched to using a completely different solution to process Artemis queues so I'm sorry but I'm not able to help with this issue.