Hello All,
I send following JSON via MQTT:
‘{“TimeStamp”:1658602981983,“WorkCenter”:“PLIATDST12”,“PlantCode”:“2345”,“LineName”:“PLT01”,“MachineName”:“CTR01”,“SensorName”:“UW2_PR_TotRMSVibVelo_1”,“AnalogValue”:232.98875427246095}’
With Topic: ‘PLT01/CTR01/UW2_PR_TotRMSVibVelo_1’
I can’t read those data on Telegraf in InfluxDB.
Below snippet from Telegraf configuration.
Try Google search: telegraf error in plugin invalid character ' ' after top-level value
This post talks about the same error message and this post is about the same setup (MQTT/Telegraf/InfluxDB). Also This Forum Post is about the same subject. All of these say something isn’t right (e.g., a bad format or unexpected character) in the JSON.
Hello
the problem is ‘\x00’ at the end of JSON payload. This is added on PLC level, where JSON message is created. I can’t manipulate it.
New idea would be to use JSON version 2 with parsing.
I tried this:
[[inputs.mqtt_consumer.json_v2]]
timestamp_path = “TimeStamp”
timestamp_format = “unix”
But now I get message “Invalid JSON provided, unable to parse”
How to configure Telegraf config file to use JSON ver 2 ?
No clear documentation is available.
I think my issue is very simple but there is no informative example how to handle it.
I have topic: ‘PLT01/CTR01/UW2_PR_TotRMSVibVelo_1’
And JSON payload:
‘{“TimeStamp”:1658602981983,“WorkCenter”:“PLIATDST12”,“PlantCode”:“2345”,“LineName”:“PLT01”,“MachineName”:“CTR01”,“SensorName”:“UW2_PR_TotRMSVibVelo_1”,“AnalogValue”:232.98875427246095}’ - last char is NULL.