Counting number of matching tags

Is it possible to count the number of rows that match a criteria? Doesn’'t seem like it is possible in the Grafana UI, but maybe have to use a continuous query?

From the CLI, the following query will return ~35 rows. Id’ like it to return just the count.
###show series from where <key=‘tag’>###
show series from metrics where service=‘SSH’

Here is an example line from the result;

This way I can plot in Grafana how many SSH services I have in real time.

How about this?

 show tag values cardinality from "metrics" with key = "service"

That will return every service, of which there are >3000. I’m just looking for the ‘SSH’ one. If it’s not possible, I can always query this information outside of Grafana and insert into influxdb. Just thought it ought to be doable within the Influx QL.

Maybe add a where clause?

show tag values cardinality from "metrics" with key = "service" where "service" = 'SSH'

Doesn’t return any results when using the where clause.

Third times the charm?

show tag values cardinality from "metrics" with key = "host" where "service" = 'SSH'

Hey Thanks @daniel, that one worked. Now figuring out best way to show cardinality results in Grafana.