Im sending data over mqtt, telegraf, influx grafana.
When 1 the “power0” field is 0, there is no need to store in the database for some devices.
For some others I need also the 0 values, otherwise the “mean” values are wrongly calculated in grafana.
I can use 2 different scripts, no issue, but i don’t know exactly how to use the starlark to drop the input.
This is my current telegraf config for devices storing all values.
[[inputs.mqtt_consumer]]
servers = ["tcp://127.0.0.1:1883"]
topics = [
"EM/pw0",
]
username = "M"
password = "M"
data_format = "json_v2"
[[inputs.mqtt_consumer.topic_parsing]]
topic = "EM/pw1"
[[inputs.mqtt_consumer.json_v2]]
timestamp_path = "epoch"
timestamp_format = "unix"
measurement_name = "Power1"
[[inputs.mqtt_consumer.json_v2.tag]]
path = "id"
type = "string"
[[inputs.mqtt_consumer.json_v2.field]]
path = "power0"
type = "float"