Problem: Telegraf is giving a strconv.ParseFloat error on a field that has been set to be ignored in the telegraf.conf file
Given the following:
An MQTT message with topic name “RSF/TASMOTA/7CC7DC/SENSOR” and json payload of
{
"Time": "2023-07-22T10:22:32",
"ANALOG": {
"A1": 45
},
"FLOW": {
"K": 0.153,
"Offset": 1.047,
"FlowPeriod": 0,
"Rate": 0,
"RateFactor": 1,
"VolumeThisFlow": 0,
"1HrVolume": 0,
"24HrVolume": 0,
"Current1HrVolume": 0,
"Current24HrVolume": 0,
"FlowUnits": "GPM",
"VolumeUnits": "GAL",
"SW-Version": "1.4a",
"ExcessFlow": false
}
}
The /etc/telegraf/telegraf.d/local.conf entry for this topic
[[inputs.mqtt_consumer]]
servers = ["tcp://localhost:1883"]
qos = 0
topics = ["RSF/TASMOTA/#",]
namedrop = ["message*"]
name_override = "mqtt"
client_id = ""
username = ""
password = ""
data_format = "json"
fielddrop = [
"TypeText",
"FlowUnits",
"VolumeUnits",
"SW-Version",
"ExcessFlow",
"Status",
"Message",
"SSId",
"BSSId",
"Mode",
"SleepMode",
"TempUnit"
]
[inputs.mqtt_consumer.tags]
siteid="rsf01"
I expect the fields listed in “fielddrop” to be ignored. In the /var/log/telegraf/telegraf.log file the following message is displayed:
2023-07-22T18:36:16Z E! [inputs.mqtt_consumer] Error in plugin: strconv.ParseFloat: parsing "0.16,\"FlowUnits\":\"GPM\",\"VolumeUnits\":\"GAL\",\"SW-Version\":\"1.4a\",\"ExcessFlow\":false}}": invalid syntax
I expect that it is something I’ve done wrong, however, any help would be appreciated.