Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SHOW TAG VALUES for a subset of hosts (multiple tags) #5245

Closed
daviesalex opened this issue Dec 30, 2015 · 7 comments
Closed

SHOW TAG VALUES for a subset of hosts (multiple tags) #5245

daviesalex opened this issue Dec 30, 2015 · 7 comments

Comments

@daviesalex
Copy link
Contributor

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...

@beckettsean
Copy link
Contributor

@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.

@prune998
Copy link

prune998 commented Mar 3, 2016

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

@prune998
Copy link

prune998 commented Mar 3, 2016

related issue : #5668

@toni-moreno
Copy link

👍 👍

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"

@sbengo
Copy link

sbengo commented Apr 14, 2016

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:

centroTagValues
----------------------
centro
c2

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

centroTagValues
----------------------
centro
c1

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

centroTagValues
----------------------
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

@jsternberg
Copy link
Contributor

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.

@TotallyInformation
Copy link

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
>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants