I’m configuring the inputs.mqtt_consumer and if I set topic to:
topic = ["topic/#"]
all works fine, but if I set:
topic = ["$share/topic/#"]
all work the same but every message I receive this error on the logs
[inputs.mqtt_consumer] Error in plugin: must be an object or an array of objects
Any idea why?
servers = ["tcp://broker:1883"]
# topics = ["topic/#"]
topics = ["$share/topic/#"]
qos = 2
connection_timeout = "30s"
username = "username"
password = "password"
json_name_key = "endpoint"
tag_keys = ["host"]
json_string_fields = ["value"]
data_format = "json"
docker telegraf version: telegraf:1.19
Welcome to the community ! Correct me if I am wrong here but using the $ sign before a topic is to collect internal stats on the topic itself?
Are these stats received in a JSON structure?
Hi @Jay_Clifford ,
The $share is to subscribe to a shared topic(Shared subscription - MQTT 5.0 new features | EMQ), this way if I have multiple clients in that shared topic the broker divide the messages between them.
Sorry for the late reply. I see this is an MQTT 5.0 feature. I believe the underlining lib that we are using supports: MQTT 3.1/3.1. : GitHub - eclipse/paho.mqtt.golang.
If you would like to make a feature request for MQTT 5.0 support please crate one within the Telegraf git. From there I can flag it with the maintainers to see what can be done.
Problem solved if puts
topics = ["$share/username/topic/#"]
Is required to pass username too.