Sorry for not understanding the config fil. And the help files. But I need som more help to understand how to setup telegraf to get the rigth data from the MQTT server and push it to influxDB2
I think I have made a good setup for sending the values to the broker.
/Adress/RomName/Device/{Device info}
/Glommensgate1/stue/RT_TV/{“Device”:“B5 Stue ved dor”,“T_PV”:“20.39”,“T_SP”:“20.5”}
/Glommensgate1/stue/RT_Ovn/{“Device”:“B7 Stue ved kjokken”,“T_PV”:“0.0”,“T_SP”:“20.5”}
/Glommensgate1/stue/RT_Tak/{“Device”:“Stue Smoke 1”,“T_PV”:“21.9”,“T_SP”:“20.5”}
I tride to use
data_format = “influx”
The I get these errors.
2021-03-14T23:48:11Z E! [inputs.mqtt_consumer] Error in plugin: metric parse error: expected field at 1:19: “{“Device”:“B5 Stue ved dor”,“T_PV”:“20.39”,“T_SP”:“20.5”}”
Then I tride with
data_format = “json”
#json_name_key = “Device”
#json_name_key = “stue”
But I don’t understand how to use the key names
Can somebody give me an example with thise to values
/Glommensgate1/stue/RT_TV/{“Device”:“B5 Stue ved dor”,“T_PV”:“20.38”,“T_SP”:“20.5”}
/Glommensgate1/gang/RT_gulv/{“Device”:"",“T_PV”:“22.4”,“T_SP”:“22.5”}
My telegraf.conf file:
[agent]
interval = “10s”
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = “0s”
every 10-15s
flush_jitter = “0s”
precision = “”
debug = true
quiet = false
logfile = “”
hostname = “”
omit_hostname = false
[[outputs.influxdb_v2]]
token = “$INFLUX_TOKEN”
organization = “stormautomasjon”
bucket = “mqtt”
[[inputs.mqtt_consumer]]
servers = [“tcp://localhost:1883”]
topics = [
“Glommensgate1/stue/#”,
“Glommensgate1/bad/#”,
]
topic_tag = “topic”
username = “"
password = "*”
… # data_format = “influx”
#data_format = “json”
#data_format = “value”
#data_type = “float”
#json_name_key = “Device”
#json_name_key = “stue”