Menu
Grafana Cloud RSS

Send metrics data from Prometheus

To get Prometheus metrics into Grafana Cloud, configure Prometheus to push scraped samples using remote_write. remote_write allows you to forward scraped samples to compatible remote storage endpoints. To learn more, please see remote_write from the Prometheus docs.

Send data from a Prometheus instance

To send Prometheus data to Grafana Cloud Metrics you will need a running Prometheus instance in your environment, as in the following diagram:

Local Prometheus Architecture

Add the following remote_write snippet to your Prometheus configuration file (often prometheus.yml). You can find the /api/prom/push URL, username, and password for your metrics endpoint by clicking on Details in the Prometheus card of the Cloud Portal:

yaml
remote_write:
  - url: <Your Metrics instance remote_write endpoint>
    basic_auth:
      username: <Your Metrics instance ID>
      password: <Your Cloud Access Policy token>

Send Prometheus native histograms

Note

The native histogram data type is currently in private preview. Grafana Labs offers support on a best-effort basis, and breaking changes might occur prior to the feature being made generally available.

To request access to the preview, file a support request.

Send 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. You can find the /api/prom/push URL, username, and password for your metrics endpoint by clicking on Details in the Prometheus card of the Cloud Portal:

First Prometheus instance:

yaml
global:
  external_labels:
    origin_prometheus: prometheus01
remote_write:
  - url: <Your Metrics instance remote_write endpoint>
    basic_auth:
      username: <Your Metrics instance ID>
      password: <Your Cloud Access Policy token>

Second Prometheus instance:

yaml
global:
  external_labels:
    origin_prometheus: prometheus02
remote_write:
  - url: <Your Metrics instance remote_write endpoint>
    basic_auth:
      username: <Your Metrics instance ID>
      password: <Your Cloud Access Policy token>

Send 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. You can find the /api/prom/push URL, username, and password for your metrics endpoint by clicking on Details in the Prometheus card of the Cloud Portal:

First HA Prometheus instance:

yaml
global:
  external_labels:
    cluster: prom-team1
    __replica__: replica1
remote_write:
  - url: <Your Metrics instance remote_write endpoint>
    basic_auth:
      username: <Your Metrics instance ID>
      password: <Your Cloud Access Policy token>

Second HA Prometheus instance:

yaml
global:
  external_labels:
    cluster: prom-team1
    __replica__: replica2
remote_write:
  - url: <Your Metrics instance remote_write endpoint>
    basic_auth:
      username: <Your Metrics instance ID>
      password: <Your Cloud Access Policy token>

Use the cluster label to identify the HA Prometheus cluster shipping data to Grafana Cloud Metrics. Set the __replica__ label to a unique value within the HA Prometheus cluster. It drops when Grafana Cloud Metrics deduplicates and ingests the data.

To learn more about how deduplication works, refer to Configure Grafana Mimir high-availability deduplication in the Grafana Mimir documentation.

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

The Monitoring a Linux host using Prometheus and node_exporter provides a complete start to finish example of installing a local Prometheus instance and using remote_write to send metrics from the instance to Grafana Cloud.

Scrape metrics from a Prometheus endpoint

With the Metrics Endpoint integration, you can automate the scraping of any Prometheus-compatible publicly accessible URL. The scraped metrics are then stored in Grafana Cloud, without requiring any additional infrastructure. You can set up multiple configurations, known as “scrape jobs”, to simultaneously monitor multiple URLs.

This method is recommended for serverless environments or platforms that do not provide access to the underlying infrastructure to install monitoring tools.

To learn more about this method, please review the Metrics Endpoint integration for Grafana Cloud guide.