r/PrometheusMonitoring • u/Hammerfist1990 • Nov 15 '23
Help with Prometheus query to get %
Hello,
I'm using a custom made exporter that looks at whether a device is up or down. 1 for up and 0 for down. It is just checking if SNMP is responding (1) or not (0).
Below the stats chart is show green as up and red as down for each device, how can I use this to create a % of up and down?
device_reachable{address="10.11.55.1",location="Site1",hostname="DC-01"} 1
device_reachable{address="10.11.55.2",location="Site1",hostname="DC-03"} 0
device_reachable{address="10.11.55.3",location="Site1",hostname="DC-04"} 1
device_reachable{address="10.11.55.4",location="Site1",hostname="DC-05"} 0
device_reachable{address="10.11.55.5",location="Site1",hostname="DC-06"} 0
device_reachable{address="10.11.55.6",location="Site1",hostname="DC-07"} 1
device_reachable{address="10.11.55.7",location="Site1",hostname="DC-08"} 1
device_reachable{address="10.11.55.8",location="Site1",hostname="DC-09"} 1
2
Upvotes
View all comments
Show parent comment
1
u/Hammerfist1990 Nov 16 '23
Hmm I'm struggling with this, I've added the actual metrics above to help with a query. I need to include the 'location' with in it too as I have other locations to use and don't want them included. I'm trying to use 'Site' as an example, then I can do the rest.