I'd like to graph scrape duration for a particular target.

The Prometheus web interface has a Status of Targets page, which tabulates the (time elapsed since) "last scrape" and corresponding "scrape duration". Does Prometheus itself publish metrics such as scrape count and cumulative duration, or are scrape durations logged someplace else?

1 Answer 1


Yes, you can use the scrape_duration_seconds metric.

Then you can run queries in the Prometheus query box like:

scrape_duration_seconds{instance="localhost:9100", job="node"}[5m]

or use Grafana.

To count the (incremented) number of scrapes served by the exporter, I believe what you want is the promhttp_metric_handler_requests_total metric. The metric is returned multiple times along with resulting HTTP status code: 200, 500, 503, possibly others. Successful scrapes have code 200. Other status codes will typically show a count of zero.

If you are only interested in counting successful scrapes, you could do something like this:

promhttp_metric_handler_requests_total{instance="localhost:9100", job="node", code="200"}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.