Collecting metrics by using Prometheus remote write
You can configure Prometheus remote write to collect metrics from environments where a Monitoring agent is not available and send them to a Monitoring instance.
You can collect metrics from:
- An existing Prometheus server.
- Ephemeral or batch jobs that may not exist long enough to be scraped by a Monitoring agent.
- Windows hosts and other operating systems where the Monitoring agent is not available
- Non-x86 based architectures, typically seen on IoT environments or Edge computing.
- Non-containerized workloads, such as NGNIX, custom applications, RabbitMQ, and others.
You can monitor the metrics that are collected by using Prometheus remote write through the Monitoring web UI. You can also use PromQL to query the data by using the standard Prometheus query language.
Configuring Prometheus remote write
You can configure your Prometheus server to remote write to a Monitoring instance. For example,
-
You can configure the Prometheus server that runs in a Kubernetes cluster in different ways. Depending on how you installed it, you can choose any of the following options to configure the remote write feature in Prometheus to send metrics to an IBM Cloud Monitoring instance:
-
Configure a Prometheus server that is managed by Prometheus Operator
-
Configure a Prometheus server by using Helm
-
Configure a Prometheus server through a Kubernetes ConfigMap
For more information, see Collecting metrics from a Kubernetes cluster by using Prometheus remote write.
-
-
You can configure Prometheus remote write on a Linux host. For more information, see Collecting metrics on Linux based infrastructures by using Prometheus remote write.
-
You can monitor the health, behavior, and performance of a WebSphere Application Server 9.0.5.9 or later by using IBM Cloud Monitoring. The WebSphere Application Server can run in the IBM Cloud, outside the IBM Cloud, or on-prem.
For more information, see Collecting metrics from WebSphere Application Server by using Prometheus remote write.
Prometheus v2.25 and previous versions
For Prometheus v2.25 and previous versions, you must configure the remote_write
section in your prometheus.yml
configuration file as follows:
global:
external_labels:
[ <labelname>: <labelvalue> ... ]
remote_write:
- url: "https://<INGESTION_URL>/prometheus/remote/write"
bearer_token: "<MONITOR_API_TOKEN>"
Where
<MONITOR_API_TOKEN>
contains the authorization token. For more information, see Working with Monitor API tokens.<INGESTION_URL>
indicates the ingestion endpoint. You must set this value to the ingestion endpoint for the region where the Monitoring instance is available. For more information, see Endpoints.
Prometheus version 2.26 and later versions
For Prometheus version 2.26 and later versions, you must configure the remote_write
section in your prometheus.yml
configuration file as follows:
global:
external_labels:
[ <labelname>: <labelvalue> ... ]
remote_write:
- url: "https://<INGESTION_URL>/prometheus/remote/write"
authorization:
credentials: "<MONITOR_API_TOKEN>"
Where
<MONITOR_API_TOKEN>
contains the authorization token. For more information, see Working with Monitor API tokens.<INGESTION_URL>
indicates the ingestion endpoint. You must set this value to the ingestion endpoint for the region where the Monitoring instance is available. For more information, see Endpoints.
Managing metrics collected via remote write
By default, when you configure your Prometheus server to remote write to a Monitoring instance, all metrics are collected and include a remote_write: true
label to easily identify them.
Controling the metrics that are sent
You can manage and control the metrics that you collect and send to a Monitoring instance. To select which series and labels to collect, and reduce the number of active series that are sent to the Monitoring instance, you can set up relabel
configurations by using the write_relabel_configs
block within your remote_write
section.
For example, to collect metrics from 1 namespace my-namespace
, you can add the following:
remote_write:
- url: https://<INGESTION_URL>/prometheus/remote/write
authorization:
credentials_file: /etc/secrets/<SECRET_NAME>
write_relabel_configs:
- action: keep
regex: my-namespace
source_labels:
- namespace
Labeling metrics by Prometheus server
You can specify custom labels that are sent along with each time series that is collected by a Prometheus server by using the external_labels
block within global
.
You can use these labels to filter and define the scope of the metrics that you monitor through dashboards in the Monitoring UI.
For example, if you have 2 different Prometheus servers configured to remote write to a Monitoring instance, you can include an external label to identify each server:
# Prometheus server 1
global:
external_labels:
provider: prometheus1
remote_write:
- url: ...
# Prometheus server 2
global:
external_labels:
provider: prometheus2
remote_write:
- url: ...
Rate limits
The following table lists the default rate limits per instance:
Rate | Limit | Info |
---|---|---|
Parallel writes | 100 concurrent requests | |
Data points per minute (DPM) | 1 million | The number of data points that are sent depends on how often metrics are sent. For example, a scrape interval of 10s will submit more DPM than an interval of 60 seconds |
Number of writes per minute | 10,000 |
Ingestion endpoints for remote write
IBM Cloud Monitoring deprecated Prometheus client support of endpoints in the form https://ingest.<region>
and https://ingest.private.<region>
and replaced them with new endpoints on 31 May 2024. End of
support for the old endpoints is 31 August 2024. After that date, the old endpoints will stop working. Customers using Prometheus Remote Write need to migrate to use the new endpoints by 31 August 2024 to continue using Prometheus Remote Write.
The following table lists the public Monitoring ingestion endpoints that you can configure to collect metrics via Prometheus Remote Write:
Remote write ingestion uses TCP 443 port.
Region | Endpoint |
---|---|
Dallas (US-South ) |
https://ingest.us-south.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.us-south.monitoring.cloud.ibm.com/prometheus/remote/write |
Frankfurt (EU-DE ) |
https://ingest.eu-de.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.eu-de.monitoring.cloud.ibm.com/prometheus/remote/write |
London (EU-GB ) |
https://ingest.eu-gb.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.eu-gb.monitoring.cloud.ibm.com/prometheus/remote/write |
Madrid (EU-ES ) |
https://ingest.eu-es.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.eu-es.monitoring.cloud.ibm.com/prometheus/remote/write |
Osaka (JP-OSA ) |
https://ingest.jp-osa.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.jp-osa.monitoring.cloud.ibm.com/prometheus/remote/write |
Sao Paulo (BR-SAO ) |
https://ingest.br-sao.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.br-sao.monitoring.cloud.ibm.com/prometheus/remote/write |
Sydney (AU-SYD ) |
https://ingest.au-syd.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.au-syd.monitoring.cloud.ibm.com/prometheus/remote/write |
Tokyo (JP-TOK ) |
https://ingest.jp-tok.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.jp-tok.monitoring.cloud.ibm.com/prometheus/remote/write |
Toronto (CA-TOR ) |
https://ingest.ca-tor.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.ca-tor.monitoring.cloud.ibm.com/prometheus/remote/write |
Washington (US-EAST ) |
https://ingest.us-east.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.us-east.monitoring.cloud.ibm.com/prometheus/remote/write |
The following table lists the private Monitoring ingestion endpoints that you can configure to collect metrics via Prometheus Remote Write:
Region | Endpoint |
---|---|
Dallas (US-South ) |
https://ingest.private.us-south.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.private.us-south.monitoring.cloud.ibm.com/prometheus/remote/write |
Frankfurt (EU-DE ) |
https://ingest.private.eu-de.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.private.eu-de.monitoring.cloud.ibm.com/prometheus/remote/write |
London (EU-GB ) |
https://ingest.private.eu-gb.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.private.eu-gb.monitoring.cloud.ibm.com/prometheus/remote/write |
Madrid (EU-ES ) |
https://ingest.private.eu-es.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.private.eu-es.monitoring.cloud.ibm.com/prometheus/remote/write |
Osaka (JP-OSA ) |
https://ingest.private.jp-osa.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.private.jp-osa.monitoring.cloud.ibm.com/prometheus/remote/write |
Sao Paulo (BR-SAO ) |
https://ingest.private.br-sao.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.private.br-sao.monitoring.cloud.ibm.com/prometheus/remote/write |
Sydney (AU-SYD ) |
https://ingest.private.au-syd.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.private.au-syd.monitoring.cloud.ibm.com/prometheus/remote/write |
Tokyo (JP-TOK ) |
https://ingest.private.jp-tok.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.private.jp-tok.monitoring.cloud.ibm.com/prometheus/remote/write |
Toronto (CA-TOR ) |
https://ingest.private.ca-tor.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.private.ca-tor.monitoring.cloud.ibm.com/prometheus/remote/write |
Washington (US-EAST ) |
https://ingest.private.us-east.monitoring.cloud.ibm.com/prometheus/remote/write Deprecatedhttps://ingest.prws.private.us-east.monitoring.cloud.ibm.com/prometheus/remote/write |
Limitations
The IBM Cloud Monitoring Prometheus Remote Write feature has the following limitations:
-
Metrics that are sent to an instance can be accessed in Explore, but they are not compatible with the scope tree.
-
Only labels that are collected at source can be used to filter metrics.
-
The metadata of a metric is not sent via remote write.
-
Metrics that have a name that ends with
_total
,_sum
, or_count
are stored as a counters, otherwise they are managed as gauge. -
You can set units in Dashboards manually.
-
You cannot mix metrics with different sampling in a dashboard, for example, 10s and 1min.
Consider configuring the scrape interval to be 10s so that you can combine Prometheus Remote Write metrics with Monitoring agent metrics.