I am graphing per subnet DHCP utilization. I want to use Stat to display which subnet is most utilized and how utilized it is. For example: “10.10.10.10/24: 86%”. This query seems to return the correct information:
SELECT top(max,subnet,1)
FROM (
SELECT max("storkserver_subnet_address_utilization")
FROM "prometheus"
WHERE $timeFilter
GROUP BY time($__interval), subnet LIMIT 1
)
In Grafana, when Format as
is “Time series”, I get two tables, one for prometheus.top
and one for subnet
, and when I format it as “Table”, I get Time, top, and subnet all in the same table.
I can’t figure out how to wrestle the Stat display into showing the subnet AND the value but not the time. I’d even be ok with the subnet showing as a hover-over.
Why you are grouping by time (time($__interval)
), when you don’t need it?
I would say it will be easy remove that time grouping from the query, then removing time in the Grafana.
I agree that grouping by time() is unnecessary in this case, however, removing that term, has no effect on the output.
It looks like I found a combination of options that seems to work. This is the query:
SELECT top(max,subnet,1)
FROM (
SELECT max("storkserver_subnet_address_utilization")
FROM "prometheus"
GROUP BY subnet LIMIT 1
)
WHERE $timeFilter
I pulled the $timeFilter out to the parent query based on some performance recommendations in the Influxql documentation, and deleted the time() group by. I also set Format as
to Table
. Finally, this is how I adjusted the Value options
in the GUI
With these settings, the Stat panel only shows the numeric value in the panel, but if I hover over the number after a second or two, the subnet name pops up. I’ll take the win, however it all seems pretty “Just keep pushing buttons until something works” to me.