I’m using InfluxDB and telegraf to have a dashboard.
InfluxDB v2.4.0 (git: de247bab08) build_date: 2022-08-18T19:41:15Z
Telegraf 1.23.4 (git: HEAD 5b48f5da)
My goal is to create a table with “fwVersion” for each “MCU”.
telegraf input is an mqtt_consumer with this config
[[inputs.mqtt_consumer]]
....
topics = [ "+/+/hal" ]
name_override = "test_10"
data_format = "json_v2"
[[inputs.mqtt_consumer.json_v2]]
[[inputs.mqtt_consumer.json_v2.object]]
path = "mcu"
included_keys = [ "uuid" ]
tags = [ "target", "fwVersion", "resetCause", "mcu" ]
The input (MQTT payload) looks like this
{
"mcu":[
{
"target":"APP_MAIN",
"uuid":"0000000000003ADF",
"fwVersion":"2022.8.5",
"resetCause":"[PORST]",
"currentTicks":509804
},
{
"target":"APP_NETWORK",
"uuid":"000000000000B98B",
"fwVersion":"2022.8.5",
"resetCause":"[PORST]",
"currentTicks":512162
},
{
"target":"APP_ZIGBEE",
"uuid":"000000000000B9D8",
"fwVersion":"2022.8.5",
"resetCause":"[PORST]",
"currentTicks":512675
},
{
"target":"APP_EXT",
"uuid":"0000000000007A6A",
"fwVersion":"2022.8.5",
"resetCause":"[PORST]",
"currentTicks":509804
}
]
....
}
In addition to this mqtt_consumer, I have a processor regex to parse the topic and get the “cliend_id” and “device_id” where
topic = <cliend_id>/<device_id>/hal
The desired output is a table in “Web Admin Interface” of InfluxDB where I can see the version per MCU per device per client, plus the additional information (uuid
, resetCause
…)
Client | Device | Target | Version |
---|---|---|---|
Client_1 | Device_1 | MCU_1 | 2022.08.1 |
Client_1 | Device_1 | MCU_2 | 2022.08.2 |
Client_2 | Device_2 | MCU_1 | 2022.07.1 |
Client_2 | Device_2 | MCU_2 | 2022.07.2 |
By using this flux query
from(bucket: "rainbow")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "test_10")
|> last()
I was able to get these tables streams
But I was unable to join (merge) them all together.
Note
When I click on View raw Data, the data is printed as requested.
But I can not create a cell in dashboard with this view