Handling mqtt 5 properties in telegraf

Hey, I’d like to put user-properties from mqtt 5 messages into tags in influxdb.

I haven’t been able to find anything related to telegraf and mqtt 5 properties. Are they not supported at all?

Thanks.

Hi @sezanzeb,
So I knew this was a feature that came in MQTTv5. I must admit I haven’t really done much work with them. Can you describe how a subscriber would usually access another client’s user-properties. We support MQTTv5 but I am not sure we have built any specific mapping for user-properties. Though with your insight we might be able to achieve a work around.

Hey, thanks for your answer.

Forget what I said about tags.

If the internet connection dies, our device will remember the messages, and when the internet connection comes back send all of them.

Since afaik Telegraf is adding the timestamp, all of those messages would get wrong timestamps once they reach the server.

Instead, we want to use a user-property “time”, which is the time of when we measured our actual sensor. Once they reach Telegraf, we want Telegraf to use that timestamp for the InfluxDB insert.

The alternative is to use json_v2/timestamp_key. It seems Telegraf is using paho.mqtt.golang, there is this fork which supports mqtt 5, but it seems to be a bit different GitHub - eclipse/paho.golang: Go libraries, for example there is no ClientOptions. Therefore it is not a drop-in replacement.

We are interested in contributing and putting research into it if it is feasible. We don’t have go experts here though. Otherwise we’ll go with json payloads.

Hi @sezanzeb,
Gotcha, I will raise this internally with our Telegraf maintainers team and get back to you with their answer. I will open an issue in github aswell. If you would mind linking to the branch that you found.

If you can add the branch information here: MQTT Consumer: Support Reading User-Properties · Issue #11258 · influxdata/telegraf · GitHub