Warm tip: This article is reproduced from serverfault.com, please click

Is there a way to get all the failed targets that Prometheus knows about?

发布于 2020-12-03 09:30:13

Hi i'm working on a solution that needs to know how many targets failed to be fetched. I'm currently running a node-exporter job with static configuration, so all the hosts are known from the get go. What i would like to display in Grafana is something like "2/3 hosts are up". But i can't really seem to find a metric that contains the same numbers as shown in the image.

enter image description here

All help is much appreciated, right now i'm searching for keywords in the metrics page of whatever exporter is containing metrics, if there is an easier way of finding the correct data please let me know.

Questioner
markus randa
Viewed
0
bjakubski 2020-12-03 19:02:36
count(up == 0) by (job)

should give you "1" for "node-exporter", while:

count(up) by (job)

should give you "3".