Sum of multiple fields sent by multiple hosts

#1

Hi, I have few metrics which are being sent by multiple hosts. Now I want to sum the values of multiple fields using regex and template variables for all hosts, as a result I want single value at each time interval which is sum of all fields selected and all hosts having those fields

Influxdb Version - Latest

client_id - template variable (single choice)
TopicName - Multiple selection template variable
time_interval - time interval template variable

SELECT sum(/consumer-fetch-manager-metrics.$client_id-.?.$TopicName.bytes-consumed-rate/) FROM “dap_retention”.“kafka_mirrormaker” WHERE $timeFilter GROUP BY time($time_interval) fill(null)

The above query give me values for each field but that is not also sum of for all hosts.

here is scenario at a time if selected 2 fields

field1 field2 host
5 2 host1
7 3 host2

Desired result - value = 5 + 2 + 7 + 3

field1 field2 … fieldn host
f10 f20…fn0 host1
f11 f21…fn1 host2
. . … . .
. . … . .
. . … . .
f1m f2m …fnm hostm

required result - (f10 + f11…+f1m) + (f20 + f21…+f2m) … + (fn0 + fn1…+fnm)

#2

correction - it is not sum it is mean of all hosts