I have the following Telegraf script that is collecting data from a MQTT broker and placing it in a Influx bucket. I want to isolate the topic via its type i.e. int. You can see an example of the script below.
servers = [“server”]
topics = [my_topics]
connection_timeout = “30s”
data_format = “json_v2”
[[inputs.mqtt_consumer.json_v2.tag]] path = "x.#[type=\"Int32\"]#.y" [[inputs.mqtt_consumer.json_v2.field]] path = "x.#[type=\"Int32\"]#.y" [[inputs.mqtt_consumer.json_v2]] timestamp_path = "x.#[type=\"Int32\"]#.y" timestamp_format = "unix"
urls = ["http://localhost:8086"] token = "$INFLUX_TOKEN" organization = "z" bucket = "my_bucket"
In my influxdb bucket I am seeing all the topics as well as all the tags. However, the values I believe are being mapped incorrectly or the value of one tag is written to all the other tags.
Where am I going wrong with my script? Are there any links that will help me solve this issue? Any help or directions are much appreciated.
I hope I have been clear in my explanation. Thank you.