PromQL for location status geohash

81 views
Skip to first unread message

Nick Carlton

unread,
Feb 7, 2023, 7:35:56 AM2/7/23
to promethe...@googlegroups.com

I am using the below PromQL to get the percentage of devices that are UP within sites mapped to geolocation and mapping it with the Geomap panel in Grafana:

‘(count by (geohash,location) (up==1) / count by (geohash,location) (up)) * 100’

Is there a way to also get the value of each of the ‘count by’ instances into the final output? So I would end up with something like:

{geohash=“xxxxx”,location=“xxxxx”,total_devices=“x”,up_devices=“x”} 99%’

The reason for is this so that the values show up as a reference on the Geomap tooltip when you hover over a location, no calculations will be done with the numbers, hence wanting them as label values.

Is this possible? And if so, please could someone assist with the necessary PromQL?


Thanks

Nick

Reply all
Reply to author
Forward
0 new messages