Hello,
I’m working with influxdb only for some days and now I have a task that sounds simple but I don’t found a solution.
I have one measurement with ~60 fields. Some of the fields store the number of items received from different sensors identified by a name in brackets:
show field keys from ipsb
name: ipsb
fieldKey fieldType
…
sensor(x1).items float
sensor(x2).items float
…
sensor(xN).items float
…
To get the last value for all sensors I can use this command:
SELECT last(/sensor.*.items/) FROM “ipsb”
name: ipsb
time last_sensor(x1).items last_sensor(x2).items … last_sensor(xN).items
0 562 231 … 300
For some calculations I need to sum the last values for all sensors. 562 + 231 + … + 300
I can’t do something like
SELECT last(“sensor(x1).items”) + last(“sensor(x2).items” + last(“sensor(xN).items”) FROM “ipsb”
because I don’t know the exact number of sensors or the correct names.
Is there a way to combine addition of values with a regex select clause?