Metrics — Prometheus

MetricsPrometheus

Sending data from Prometheus

To send Prometheus data to Grafana Cloud Metrics you will need a running Prometheus instance in your environment.

Add the following remote_write snippet to your Prometheus configuration file:

remote_write:
- url: https://prometheus-us-central1.grafana.net/api/prom/push
  basic_auth:
    username: <Your Metrics instance ID>
    password: <Your Grafana.com API Key>

Sending data from multiple Prometheus instances

When sending metrics from multiple Prometheus instances, you can use the external_labels parameter to label time series data with an instance identifier. Append any external_labels to the global section of your Prometheus configuration file:

First Prometheus instance:

global:
  external_labels:
    origin_prometheus: prometheus01
remote_write:
- url: https://prometheus-us-central1.grafana.net/api/prom/push
  basic_auth:
    username: <Your Metrics instance ID>
    password: <Your Grafana.com API Key>

Second Prometheus instance:

global:
  external_labels:
    origin_prometheus: prometheus02
remote_write:
- url: https://prometheus-us-central1.grafana.net/api/prom/push
  basic_auth:
    username: <Your Metrics instance ID>
    password: <Your Grafana.com API Key>

Sending data from multiple high-availability Prometheus instances

If you’re shipping data to Grafana Cloud Metrics from multiple Prometheus instances in a high-availability (HA) configuration, you should use the cluster and __replica__ labels to deduplicate data received at the Grafana Cloud Metrics endpoint. Add these to the external_labels section in your Prometheus configuration file:

First HA Prometheus instance:

global:
  external_labels:
    cluster: prom-team1
    __replica__: replica1
remote_write:
- url: https://prometheus-us-central1.grafana.net/api/prom/push
  basic_auth:
    username: <Your Metrics instance ID>
    password: <Your Grafana.com API Key>

Second HA Prometheus instance:

global:
  external_labels:
    cluster: prom-team1
    __replica__: replica2
remote_write:
- url: https://prometheus-us-central1.grafana.net/api/prom/push
  basic_auth:
    username: <Your Metrics instance ID>
    password: <Your Grafana.com API Key>

The cluster label will identify the HA Prometheus cluster shipping data to Grafana Cloud Metrics. The __replica__ label should be set to a unique value within the HA Prometheus cluster. It will be dropped when Grafana Cloud Metrics deduplicates and ingests the data.

To learn more about Prometheus configuration parameters, please see the Prometheus.io Configuration Docs.

Data flow diagram

Prometheus API Metrics data flow diagram

Prometheus Query Endpoint

This is the URL you use get the data, for example, in the data source config in Grafana.

https://prometheus-us-central1.grafana.net/api/prom

Prometheus Remote Write Endpoint

This is the URL you use to send the data to us.

https://prometheus-us-central1.grafana.net/api/prom/push