Error in plugin: metric parse error: expected field at 1:28
Please direct all support questsions to slack or the forums. Thank you.
Hello I try several possibilites data_format = "value"' data_type ="integer"
I try all these possibilities here :
https://docs.influxdata.com/telegraf/v1.11/data_formats/input/value/
or here : https://github.com/influxdata/telegraf/blob/master/plugins/parsers/value/README.md
When I load telegraf :
# telegraf --config http://192.168.0.30:8086/api/v2/telegrafs/XXXXXXXXXXX
the output is :
2023-01-09T21:16:28Z E! [inputs.mqtt_consumer] Error in plugin: metric parse error: expected field at 1:28: "{\"dateTime\": \"1673298989.0\", \"barometer_mbar\": \"1040.9757200201998\", \"outHumidity\": \"92.0\", \"inHumidity\": \"65.0\", \"outTemp_C\": \"5.888888888888889\", \"inTemp_C\": \"18.777777777777775\", \"windSpeed_kph\": \"0.0\", \"windGust_kph\": \"0.0\", \"dewpoint_C\": \"4.666666666666666\", \"rain_cm\": \"0.0\", \"UV\": \"0.0\", \"pressure_mbar\": \"1035.5397975153705\", \"altimeter_mbar\": \"1040.9024838749738\", \"appTemp_C\": \"4.702799418964866\", \"cloudbase_meter\": \"192.53881601443027\", \"heatindex_C\": \"4.935555555555555\", \"humidex_C\": \"5.888888888888889\", \"inDewpoint_C\": \"12.055721552406476\", \"maxSolarRad_Wpm2\": \"0.0\", \"rainRate_cm_per_hour\": \"0.0\", \"windchill_C\": \"5.888888888888889\", \"hourRain_cm\": \"0.0\", \"rain24_cm\": \"0.40640000000000004\", \"dayRain_cm\": \"0.381\", \"usUnits\": \"16.0\"}"
Can someone help me ?
What sort of parsing I will use ? Best regards
Hello! I recommend posting this question in our Community Slack or Community Page, we have a lot of talented community members there who could help answer your question more quickly. You can also learn more about Telegraf by enrolling at InfluxDB University for free!
Heads up, this issue will be automatically closed after 7 days of inactivity. Thank you!
Well given the text I think you do have data_format = "influx" somewhere (or omitted the data_format) but your data is JSON!?!? How about using one of the JSON parsers then (json, json_v2 or xpath_json)?
i use a broker mqtt and the output is like that
How can I use Json parser
(I m new in the world of Influxdb and telegraf) ;-( sorry ....
My MQQT FIle configuration :

Let's do some debugging using the following configuration
[[output.file]]
files = ["stdout"]
[[inputs.mqtt_consumer]]
topics = ["wx-froggit/#"]
...
data_format = "value"
data_type = "string"
If you now start telegraf with this config (use the --config option), you should see your MQTT messages on the console in Influx line-protocol format without an error. Does that work? If so, please post some (maybe a handful) of those messages here so we have some data to guide you through the parser setup process.
Hi I just put output with S [[outputs.file]]
[[outputs.file]]
files = ["stdout"]
`root@meteo-Ubuntu:/home/stef# telegraf --config http://192.168.0.30:8086/api/v2/telegrafs/0a920c1498f39000 2023-01-10T18:53:19Z I! Starting Telegraf 1.25.0 2023-01-10T18:53:19Z I! Available plugins: 228 inputs, 9 aggregators, 26 processors, 21 parsers, 57 outputs, 2 secret-stores 2023-01-10T18:53:19Z I! Loaded inputs: mqtt_consumer 2023-01-10T18:53:19Z I! Loaded aggregators: 2023-01-10T18:53:19Z I! Loaded processors: 2023-01-10T18:53:19Z I! Loaded secretstores: 2023-01-10T18:53:19Z I! Loaded outputs: file influxdb_v2 2023-01-10T18:53:19Z I! Tags enabled: host=meteo-Ubuntu 2023-01-10T18:53:19Z I! [agent] Config: Interval:5s, Quiet:false, Hostname:"meteo-Ubuntu", Flush Interval:10s 2023-01-10T18:53:19Z I! [inputs.mqtt_consumer] Connected [tcp://127.0.0.1:1883] mqtt_consumer,host=meteo-Ubuntu,topic=wx-froggit/loop value="{"dateTime": "1673376803.0", "barometer_mbar": "1032.84838843904", "outHumidity": "97.0", "inHumidity": "66.0", "outTemp_C": "12.555555555555555", "inTemp_C": "18.499999999999996", "windSpeed_kph": "3.8624256", "windGust_kph": "7.885785600000001", "windDir": "311.0", "dewpoint_C": "12.055555555555557", "rain_cm": "0.0", "UV": "0.0", "pressure_mbar": "1027.5806591289381", "altimeter_mbar": "1032.9096149553764", "appTemp_C": "12.452536391158024", "cloudbase_meter": "100.83524335258227", "heatindex_C": "12.399444444444441", "humidex_C": "14.863137159619765", "inDewpoint_C": "12.024025884609951", "maxSolarRad_Wpm2": "0.0", "rainRate_cm_per_hour": "0.10160000000000008", "windchill_C": "12.555555555555555", "hourRain_cm": "0.05079999999999998", "rain24_cm": "0.635", "dayRain_cm": "0.635", "usUnits": "16.0"}" 1673376802715828456 mqtt_consumer,host=meteo-Ubuntu,topic=wx-froggit/loop value="{"dateTime": "1673376816.0", "barometer_mbar": "1032.84838843904", "outHumidity": "97.0", "inHumidity": "66.0", "outTemp_C": "12.555555555555555", "inTemp_C": "18.499999999999996", "windSpeed_kph": "3.8624256", "windGust_kph": "7.885785600000001", "windDir": "311.0", "dewpoint_C": "12.055555555555557", "rain_cm": "0.0", "UV": "0.0", "pressure_mbar": "1027.5806591289381", "altimeter_mbar": "1032.9096149553764", "appTemp_C": "12.452536391158024", "cloudbase_meter": "100.83524335258227", "heatindex_C": "12.399444444444441", "humidex_C": "14.863137159619765", "inDewpoint_C": "12.024025884609951", "maxSolarRad_Wpm2": "0.0", "rainRate_cm_per_hour": "0.10160000000000008", "windchill_C": "12.555555555555555", "hourRain_cm": "0.05079999999999998", "rain24_cm": "0.635", "dayRain_cm": "0.635", "usUnits": "16.0"}" 1673376815614273136 mqtt_consumer,host=meteo-Ubuntu,topic=wx-froggit/loop value="{"dateTime": "1673376828.0", "barometer_mbar": "1032.84838843904", "outHumidity": "97.0", "inHumidity": "66.0", "outTemp_C": "12.555555555555555", "inTemp_C": "18.499999999999996", "windSpeed_kph": "2.7358848", "windGust_kph": "3.8624256", "windDir": "213.0", "dewpoint_C": "12.055555555555557", "rain_cm": "0.0", "UV": "0.0", "pressure_mbar": "1027.5806591289381", "altimeter_mbar": "1032.9096149553764", "appTemp_C": "12.671585446713582", "cloudbase_meter": "100.83524335258227", "heatindex_C": "12.399444444444441", "humidex_C": "14.863137159619765", "inDewpoint_C": "12.024025884609951", "maxSolarRad_Wpm2": "0.0", "rainRate_cm_per_hour": "0.10160000000000008", "windchill_C": "12.555555555555555", "hourRain_cm": "0.05079999999999998", "rain24_cm": "0.635", "dayRain_cm": "0.635", "usUnits": "16.0"}" 1673376827703492581
`
influxdb-mqtt.txt perhaps this help you ;)
How about
[[inputs.mqtt_consumer]]
topics = ["wx-froggit/#"]
...
data_format = "xpath_json"
fielddrop = ["dateTime"]
[[inputs.mqtt_consumer.xpath]]
metric_name = "'meteo'"
field_selection = "child::*"
field_value = "number(.)"
timestamp = "dateTime"
timestamp_format = "unix"
More info for the xpath parser can be found here...
Yes that's right !

Thanks you very much Now i just do this in self service ( do i put token in config file ? ) in $INFLUX_TOKEN
Token for authentication.
token = "$INFLUX_TOKEN"
Yes. I will close this issue here. Please use the forums and/or Slack for these kind of support questions as we usually use tickets for "real" bugs, feature requests etc and support questions would clutter this too much...