Combing tags and measurements


We have an influx measurement where we collected perf data on interfaces using telegraf.

the agent created a tag field for “host” and “inteface” on the “net” table. But when selecting the values for (select * from net) there are no columns for host or interface. Therefore, when trying to group by, show in a table the interface/host name, I cannot do so since these values are external to the table. Is there a way to combine both table columns and tag field/values in a query? Any other ideas?

Hi there!

This is possible, you can add a GROUP BY

SELECT * FROM net GROUP BY host,interface

If you’re curious what tag keys are available, you can use SHOW TAG KEYS on net


The problem is that when I collect perf data from a linux server using telegraf, the host and interface values are not written in the table values, but only in tag keys.

So I can select * from values where host = ‘hostA’, but I can’t do select hostname, interface where host=‘HostA’ since there are no columns. Am I clear here?

The interface tag value will be returned as part of the series key. Is that not sufficient for you?

Failing that, your best bet is to enable Flux and use that instead. It will provide the flexibility you need :grinning:

Hi. A few questions.

  1. This is my query from within Grafana.
    *SELECT derivative(mean(“bytes_recv”), 1s) 8 FROM “net” WHERE (“host” =~ /^$host/ AND “interface” =~ /^interface/) AND $timeFilter GROUP BY time($Interval) fill(null)
    The values returned from the query are two colums:
    timestamp value

Since “interface” or “host” are not columns I cannot return them and/or use them as group by. Unless I misunderstood what you meant.

  1. How can flux help me? And also, can Grafana work with it?

You can use them in a group by, provided the tags exist.

Have you tried it as per my query above?

Awesome! Thanks.

Can you explain and or reference me somewhere we I can better understand the difference between TAG KEYS and Values.