The time is not the issue, but the joining of the 4 rows, I did not find a query in influx to support joins (from what I can see it only supports joins based on time).
So the idea was to use for 4 queries like:
query A: SELECT RX FROM data WHERE host = s1 AND iface = eth0
query B: SELECT RX FROM data WHERE host = s1 AND iface = eth1
query C: SELECT RX FROM data WHERE host = s1 AND iface = eth2
query D: SELECT RX FROM data WHERE host = s1 AND iface = eth3
and combine the query’s in a single table row
Or if there is a scenario that I can use JOIN for a single query or multiple queries on a single line I’m open to that as well.
Are all 4 queries against the same table? If they are then you should combine them into one query. If not then as you have found it is hard to join tables with InfluxDB (and to be fair to InfluxDB, the only sensible way to join is on time fields so that aggregations are possible).
Sorry, meant measurement not table (sort of the same thing in my head).
Not sure I understand why you have 4 queries? JOINs or merges are for different time series/measurements. But this looks like 4 queries against the same time series/measurement?
Here is demo dashboard that uses regex to match on hostname and datacenter:
I have had the same problem and finally managed to get something to work. The difference with my requirement is that I had to do aggregations based on at tag. I hope it helps anyone else that comes across this requirement.
The key that I discovered is that the aggregation has to take place in your outer query. I was initially trying to do it in the inner query and I was getting the correct values but the timestamps wouldn’t align even though they were the same.
What you will need to do is something like the following…
SELECT agg(“RX_0”) as “RX_eth0”, agg(“RX_1”) as “RX_eth1”, agg(“RX_2”) as “RX_eth2”, agg(“RX_3”) as “RX_eth3” FROM
(SELECT RX as “RX_0” FROM measurement WHERE iface=‘eth0’),
(SELECT RX as “RX_1” FROM measurement WHERE iface=‘eth1’),
(SELECT RX as “RX_2” FROM measurement WHERE iface=‘eth2’),
(SELECT RX as “RX_3” FROM measurement WHERE iface=‘eth3’)
WHERE $timeFilter GROUP BY host fill(0)
where agg is some aggregation or selector etc… In your case you might just want to use the last selector if there is only one value or you could probably omit it entirely.