Closed jcoliz closed 1 year ago
Hi,
If this works with mosquitto, but not VerneMQ that points to the client (e.g. paho.mqtt.golang) or VerneMQ rejecting something. I have put up https://github.com/influxdata/telegraf/pull/13352 which has the client's debug logs enabled. In 20-30mins some artifacts will be attached that you can use. Can you download the artifact for your platform and try launching that and provide those logs please?
Thanks
@powersj Thanks for having a look! I am away for a long weekend. Will try this next week.
@powersj Thanks again. I think I have this sorted now. In the process of preparing a clean repro environment to apply your version, I discovered the problem.
VerneMQ takes a long time to come up. In that time, Telegraf tries and fails to start multiple times. Something in that interaction is causing a problem between components.
I've since added a service_healthy constraint to Telegraf's dependency, and things have been 100% since then. (Illustrated below)
services:
mqtt:
image: vernemq/vernemq:1.12.6.2
healthcheck:
test: curl --fail http://localhost:8888/health || exit 1
interval: 20s
retries: 5
start_period: 10s
timeout: 5s
telegraf:
image: telegraf:1.26.3-alpine
depends_on:
influxdb:
condition: service_started
mqtt:
condition: service_healthy
Awesome! Glad to hear you got it worked out and thank you for providing what you did to resolve it.
I'll close this and the PR then.
Relevant telegraf.conf
EDIT: Reducing the complexity of this configuration for a simpler repro
Logs from Telegraf
System info
Telegraf 1.26.3, Docker version 20.10.21, build baeda1f, Ubuntu 20.04.5 LTS (on WSL)
Docker
Steps to reproduce
docker compose up
Expected behavior
Expected that a subscription to the specific topics is entered
For example, let's say I subscribe using another client. In this case I'll have my sender ALSO subscribe. This will show what it should look like:
And of course, my client gets plenty messages, so we know VerneMQ is working
Actual behavior
Telegraf does connect
Telegraf does not subscribe to any topics
We can see that the messages are retained, and of course, subscribing to them from another client works fine.
Also, we can look at the client trace. Here we can see that the telegraf client periodically pings the server, which dutifully responds.
Meanwhile, we can look at the trace from the sender, and it's chugging away great.
If we use Mosquitto instead, it works correctly. In this case, replace the
mqtt
section in the docker compose with the following. Nothing special in the mosquitto.conf. Just allowing anonymous connections.In this case we can see the expected output in the telegraf docker logs:
Additional info
This seems like the exact same behaviour as #9736, with ActiveMQ Artemis instead of VerneMQ.
Also note that I have gotten an old version of Telegraf to work with an old version of VerneMQ, when running directly on the metal (not docker), but this was a couple years ago, and I don't have those configs around.