Better Stack Prometheus metrics scraping

Start scraping metrics in 5 minutes

Better Stack can scrape metrics directly from your Prometheus exporters.

1. Setup

To get started, first you'll need to allow access to your exporters, through your firewall, from our scrape servers. The list of IP addresses we scrape from are:

Global

  • 49.12.84.22, 142.132.140.47, 142.132.140.122, 142.132.140.77, 2a01:4f8:2200:346e::/64, 2a01:4f8:261:129f::/64, 2a01:4f8:261:1280::/64, 2a01:4f8:261:1257::/64

This list is also available as a text file from https://logs.betterstack.com/prometheus-scrape-ips.txt.

All requests made when scraping your metrics will use our standard User-Agent header.

User-Agent HTTP header value
Better Uptime Bot Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36

If you currently block on user-agent you will need to allow the scraping user-agent as well.

Prometheus exporters typically reside on ports over 9100, apart from a few exceptions (full list of allocations). When configuring your firewall, you should choose the target ports accordingly to only grant access to your designated exporters, and nothing else.

2. Define your exporter URLs

When you create your source, you can add multiple exporter endpoints, as http or https URLs; typically these have an explicit port and end with a /metrics URL, for example http://app1.example.com:9100/metrics. You can use IP addresses or hostnames for connecting to your exporters.

You can also add comment lines in the exporter URL list, by starting the line with #, in case your exporters are specified as IP addresses, to help record which exporters are which.

Authentication

If your metrics exporter endpoint requires authentication, expand "Advanced settings", where you can provide any custom headers for your metric scrape requests.

For bearer token authentication, add an Authorization header, with Bearer <token>. If you're using basic HTTP authentication, provide the username and password directly.

3. Using your metrics

As soon as you save a set of metrics URLs, we will start scraping for metrics. If we're able to connect successfully to your exporters, metrics should be available within about a minute for new sources.

You can use the Prometheus dashboard to immediately see the results for a prometheus node exporter, or create your own dashboard to analyze your metrics.

We automatically add a host metric label for all scraped metrics, set to the host portion of the exporter URL. For example, if the exporter URL is http://app1.example.com:9100/metrics, we will add a host: app1.example.com label to those metrics. This lets you filter/group by host in your charts without having to configure additional prometheus labels. If a host label is already present on a metric, that value takes precedence.

Need help?

Please let us know at hello@betterstack.com.
We're happy to help! 🙏