---
title: "Cloudflare integration | Grafana Cloud documentation"
description: "Learn about Cloudflare Grafana Cloud integration."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Cloudflare integration for Grafana Cloud

Cloudflare is a globally distributed network infrastructure and cybersecurity company that provides content delivery, DDoS mitigation, internet security, and other related services to enhance the performance and security of websites and internet applications. This integration for Grafana Cloud allows users to collect and analyze metrics for `Cloudflare Analytics - account and zone analytics`, a description of which is found [here](https://developers.cloudflare.com/analytics/account-and-zone-analytics/).

Metrics include requests, bandwidth, CPU utilization, HTTP response codes, pool health, and colocation information. These are used to provide valuable visualizations for zones, workers, and pools.

This integration requires `Pro Plan` or better Cloudflare subscriptions.

This integration includes 5 useful alerts and 3 pre-built dashboards to help monitor and visualize Cloudflare metrics.

## Before you begin

In order for the integration to properly work, you must set up the [Cloudflare Prometheus exporter](https://github.com/lablabs/cloudflare-exporter) to export metrics from Cloudflare.

#### Get an API token

It is recommended to authenticate the exporter using an API token, which can be created by following this [guide](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/).

This newly created token will also need to be given certain permissions so the exporter can retrieve metrics. These permissions are:

- `Account Analytics: Read`
- `Account Settings: Read`
- `Analytics: Read`

#### Set up Cloudflare exporter

The exporter can be configured by following this [guide](https://github.com/lablabs/cloudflare-exporter).

To build and run the exporter, use the following commands.

This command will build the exporter binary with the name `cloudflare_exporter`.

sh ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```sh
make build
```

This uses the API token authentication method, so be sure to replace `<cloudflare-api-token>` with the token generated in the previous step. It also uses the useful flag `-listen` which will set the port metrics are served at. The default port is `8080` which may be an issue if you have a pre-existing process using that port.

sh ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```sh
./cloudflare_exporter -listen=:<port_number> -cf_api_token=<cloudflare-api-token>
```

## Install Cloudflare integration for Grafana Cloud

1. In your Grafana Cloud stack, click **Connections** in the left-hand menu.
2. Find **Cloudflare** and click its tile to open the integration.
3. Review the prerequisites in the **Configuration Details** tab and set up Grafana Alloy to send Cloudflare metrics to your Grafana Cloud instance.
4. Click **Install** to add this integration’s pre-built dashboards and alerts to your Grafana Cloud instance, and you can start monitoring your Cloudflare setup.

## Configuration snippets for Grafana Alloy

### Advanced mode

The following snippets provide examples to guide you through the configuration process.

To instruct Grafana Alloy to scrape your Cloudflare instances, **manually** copy and append the snippets to your alloy configuration file, then follow subsequent instructions.

### Advanced metrics snippets

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
prometheus.scrape "metrics_integrations_integrations_cloudflare" {
	targets = [{
		__address__ = "<exporter_hostname>:<exporter_port>",
		instance    = constants.hostname,
	}]
	forward_to = [prometheus.remote_write.metrics_service.receiver]
	job_name   = "integrations/cloudflare"
}
```

To monitor your Cloudflare instance, you must use a [discovery.relabel](/docs/alloy/latest/reference/components/discovery.relabel/) component to discover your Cloudflare Prometheus endpoint and apply appropriate labels, followed by a [prometheus.scrape](/docs/alloy/latest/reference/components/prometheus.scrape) component to scrape it.

Configure the following properties within each `discovery.relabel` component:

- `__address__`: The address to your Cloudflare Prometheus metrics endpoint.
- `instance` label: `constants.hostname` sets the `instance` label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this Cloudflare instance.

If you have multiple Cloudflare servers to scrape, configure one `discovery.relabel` for each and scrape them by including each under `targets` within the `prometheus.scrape` component.

## Dashboards

The Cloudflare integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.

- Cloudflare geomap overview
- Cloudflare worker overview
- Cloudflare zone overview

**Cloudflare zone overview 1**

**Cloudflare zone overview 2**

**Cloudflare zone overview 3**

## Alerts

The Cloudflare integration includes the following useful alerts:

Expand table

| Alert                        | Description                                                                                     |
|------------------------------|-------------------------------------------------------------------------------------------------|
| CloudflareHighThreatCount    | Critical: There are detected threats targeting the zone.                                        |
| CloudflareHighRequestRate    | Warning: A high spike in requests is occurring which may indicate an attack or unexpected load. |
| CloudflareHighHTTPErrorCodes | Warning: A high number of 4xx or 5xx HTTP status codes are occurring.                           |
| CloudflareUnhealthyPools     | Critical: There are unhealthy pools.                                                            |
| CloudflareMetricsDown        | Critical: Cloudflare metrics are down.                                                          |

## Metrics

The most important metrics provided by the Cloudflare integration, which are used on the pre-built dashboards and Prometheus alerts, are as follows:

- cloudflare\_worker\_cpu\_time
- cloudflare\_worker\_duration
- cloudflare\_worker\_errors\_count
- cloudflare\_worker\_requests\_count
- cloudflare\_zone\_bandwidth\_cached
- cloudflare\_zone\_bandwidth\_content\_type
- cloudflare\_zone\_bandwidth\_ssl\_encrypted
- cloudflare\_zone\_bandwidth\_total
- cloudflare\_zone\_colocation\_requests\_total
- cloudflare\_zone\_pageviews\_total
- cloudflare\_zone\_pool\_health\_status
- cloudflare\_zone\_pool\_requests\_total
- cloudflare\_zone\_requests\_browser\_map\_page\_views\_count
- cloudflare\_zone\_requests\_cached
- cloudflare\_zone\_requests\_status
- cloudflare\_zone\_requests\_total
- cloudflare\_zone\_threats\_total
- cloudflare\_zone\_uniques\_total
- up

## Changelog

md ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```md
# 1.1.0 - May 2026

- Updated dashboards to follow new stylistic standards
- Renamed dashboard "Cloudflare Geomap overview" to "Cloudflare geomap overview"

# 1.0.2 - December 2024

- Only return latest metric in status panel check query

# 1.0.1 - November 2024

- Update status panel check queries

# 1.0.0 - November 2023

* Initial release
```

## Cost

By connecting your Cloudflare instance to Grafana Cloud, you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see [Active series and dpm usage](/docs/grafana-cloud/fundamentals/active-series-and-dpm/) and [Cloud tier pricing](/products/cloud/pricing/).
