Influxdb: SHOW TAG VALUES for a subset of hosts (multiple tags)

Created on 30 Dec 2015  路  7Comments  路  Source: influxdata/influxdb

I want to offer users the opportunity to glob hosts on a dashboard to show graphs for similar hosts.

Is it possible to retrieve the TAG VALUES for all measurements for a glob of hosts? Clearly I can do this:

> SHOW TAG VALUES FROM netif_netif WITH KEY IN ("interface");
name: interfaceTagValues
------------------------
interface
bond0
bond1
bond2
docker0
dummy0
eno1
eno2
eno2.25
eno2.27
...

Unfortunately, in our environment, that returns hundreds and hundreds of results for every possible interface (including every VLAN tag) across thousands of machines.

The docs (https://influxdb.com/docs/v0.9/query_language/schema_exploration.html#explore-tag-values-with-show-tag-values) only give an example of a single WITH KEY, but what I really want to do is something like this:

SHOW TAG VALUES FROM netif_netif WITH KEY IN ("interface") WHERE  host =~ /$host_glob.*/  

Is this possible today? If not, is this a reasonable feature request? Otherwise we either have to provide a Grafana list of options that is hundreds long (and for some metrics this will be thousands), or hard code specific interfaces unless there is a third way...

arequeries kinfeature-request

Most helpful comment

Hi,
I'm using InfluxDB 0.10.3 and tested to have dependant templates on grafana, as @toni-moreno.

Looking at influx code, show tag values accepts a where clause. In the following example:
c1 -> s1, s2
c2 -> s4

1-Double quotes on string:
Request: HOW TAG VALUES from /system.cpu.*/ WITH KEY IN (centro) WHERE site = "s4" Response:Success! (no results to display)`

2-Single quotes on string:
Request: SHOW TAG VALUES from /system.cpu.*/ WITH KEY IN (centro) WHERE site = 's4'
Response:

----------------------
centro
c2

Request: SHOW TAG VALUES from /system.cpu.*/ WITH KEY IN (centro) WHERE site = 's2'
Response:

----------------------
centro
c1

3-Regex expression:
Request: SHOW TAG VALUES from /system.cpu.*/ WITH KEY IN (centro) WHERE site =~ /^s.*/
Response:

----------------------
centro
c1
c2

So as briefview, it seems that it doesn't work with double quotes!

About Grafana, it is actually working using the 2 and 3 format

All 7 comments

@daviesalex it's a reasonable feature request but there's currently no support for it.

You can accomplish the same thing by selecting a throwaway field and doing a fair bit of post-processing:

SELECT interface, throwaway_field FROM netif_netif WHERE host =~ /$host_glob.*/

Unfortunately the DISTINCT function only operates on fields, not on tags, and ORDER BY only works against timestamps, so you would have to manually sort and de-dupe the results.

+1 on a where clause in SHOW TAG !!!
This is a needed feature.

:+1: :+1:

Please We need this a lot. :)

We've been working a lot with graphite and grafana and we are used to work with dashboards with dependent templated values ( realy usefull)

In the following example we have a very simple Cisco Switch dashboard.

image

with these template values:

image

As you can see we can see interface name that doesn't exist in the selected cisco switch.

We need filter the tag values with the host name

SHOW TAG VALUES FROM lan_metrics."1min"./.*/ WITH KEY = "portName" where host = "cisco00"

Hi,
I'm using InfluxDB 0.10.3 and tested to have dependant templates on grafana, as @toni-moreno.

Looking at influx code, show tag values accepts a where clause. In the following example:
c1 -> s1, s2
c2 -> s4

1-Double quotes on string:
Request: HOW TAG VALUES from /system.cpu.*/ WITH KEY IN (centro) WHERE site = "s4" Response:Success! (no results to display)`

2-Single quotes on string:
Request: SHOW TAG VALUES from /system.cpu.*/ WITH KEY IN (centro) WHERE site = 's4'
Response:

----------------------
centro
c2

Request: SHOW TAG VALUES from /system.cpu.*/ WITH KEY IN (centro) WHERE site = 's2'
Response:

----------------------
centro
c1

3-Regex expression:
Request: SHOW TAG VALUES from /system.cpu.*/ WITH KEY IN (centro) WHERE site =~ /^s.*/
Response:

----------------------
centro
c1
c2

So as briefview, it seems that it doesn't work with double quotes!

About Grafana, it is actually working using the 2 and 3 format

I think we accidentally implemented this at some point. It seems to work for me on master and 0.13. I'm closing this. Please reopen if it still isn't working.

This still doesn't work:

Connected to http://localhost:8086 version 1.6.4
InfluxDB shell version: 1.7.1
Enter an InfluxQL query
> use environment_db
Using database environment_db
> SHOW TAG VALUES FROM "lights" WITH KEY = "location" WHERE location != 'NA'
name: lights
key      value
---      -----
location Front Hall
location Landing
location Living Room
location Loft Main
location Rear Hall
location Tree
> SHOW TAG VALUES FROM "lights" WITH KEY = "location" WHERE location != "NA"
name: lights
key      value
---      -----
location Front Hall
location Landing
location Living Room
location Loft Main
location NA
location Rear Hall
location Tree
>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Witee picture Witee  路  3Comments

shilpapadgaonkar picture shilpapadgaonkar  路  3Comments

robinjha picture robinjha  路  3Comments

dtouzeau picture dtouzeau  路  3Comments

deepujain picture deepujain  路  3Comments