Hi,
I have a tag_name (node) with node ips (192.168.1.1, 192.168.1.2 etc) and i want to count the number of the exist nodes.
Is there a way to count the number of values in a template variable?
Your exact use case is not clear. I assume that InfluxDB is used, so you can use InfluxDB directly - https://docs.influxdata.com/influxdb/v1.7/query_language/spec/#show-tag-values-cardinality
Hi jangaraj,
I think my question is similar to this one but I wasn’t able to find answer in the link you provided and neither in the community, so thought of asking you.
My InfluxDB query in Grafana:
SELECT sum(“data_value”) FROM /^$Assets$/ WHERE (“department” =~ /^$Department$/ AND “asset_value” = ‘Uptime’) AND $timeFilter
“Assets” and “Department” are variables that I defined and the results of “Assets” variable depends upon the “Department” variable chosen. For example:
“Department A” has 20 Assets like A1, A2, A3, A4…A20
“Department B” has 5 Assets like B1, B2, B3, B4,B5
“Department C” has 10 Assets like C1, C2, C3, C4…C10
and so on…
So I want to use the number of Assets (20,5 or 10) in the query as a variable and divide it by sum(“data_value”). So if I have chosen Department B in the dashboard drop down option, it should automatically divide sum(“data_value”) by 5 since there are 5 assets in that department. Is there a way to do that?
Thank you!