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

# Consul integration for Grafana Cloud

[Consul](https://developer.hashicorp.com/consul/docs/intro) is a service mesh solution providing a full featured control plane with service discovery, configuration, and segmentation functionality.

Consul is split into a [client-server architecture](https://developer.hashicorp.com/consul/docs/architecture) by which servers provide a control plane into the cluster of clients, and clients form a mostly stateless data plane alongside the sidecar proxy on each node running your applications and services.

Since [Consul provides first-class support for Envoy](https://developer.hashicorp.com/consul/docs/connect/proxies/envoy) as a sidecar proxy, it is strongly recommended that you also install the [Grafana integration for Envoy](/docs/grafana-cloud/monitor-infrastructure/integrations/integration-reference/integration-envoy/), assuming that you are using it.

This integration includes 3 useful alerts and 1 pre-built dashboard to help monitor and visualize Consul metrics.

## Before you begin

This integration relies on a running Consul deployment.

Consul exposes health metrics over port `8500` by default, which Alloy’s `consul_exporter` can then scrape.

Determine your usage scenario and potentially set up a [Consul ACL token](https://developer.hashicorp.com/consul/api-docs/acl) accordingly. See [this tutorial from Hashicorp](https://developer.hashicorp.com/consul/tutorials/security/access-control-setup-production#access-control-setup-production) for further details on how to set up ACLs for your Consul instance.

1. You can choose to use the `consul_exporter` configuration in the `integrations` Grafana Alloy configuration block, without an ACL token. This will give you access to metrics from Consul’s [Status API](https://developer.hashicorp.com/consul/api-docs/status), which is enough to populate all of the integration dashboard panels.
2. If you want the additional metrics provided, beyond what the integration dashboard supports, you can choose to additionally provide a `scrape_config` entry in the `metrics` Grafana Alloy configuration block that targets Consul’s Prometheus-compatible [Agent Telemetry API](https://developer.hashicorp.com/consul/docs/agent/telemetry). This requires an ACL token with `agent:read` privileges to be specified in the `scrape_config` entry. Per [this Consul documentation](https://developer.hashicorp.com/consul/docs/agent/config/config-files#telemetry-prometheus_retention_time), you will need to add the following telemetry snippet to your Consul agent config. This will enable a Prometheus-compatible metrics scraping endpoint on the Consul client:
   
   ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```none
   "telemetry": {
       "prometheus_retention_time": "72h",
       "disable_hostname": true
   }
   ```

## Install Consul integration for Grafana Cloud

1. In your Grafana Cloud stack, click **Connections** in the left-hand menu.
2. Find **Consul** and click its tile to open the integration.
3. Review the prerequisites in the **Configuration Details** tab and set up Grafana Alloy to send Consul metrics to your Grafana Cloud instance.
4. Click **Install** to add this integration’s pre-built dashboard and alerts to your Grafana Cloud instance, and you can start monitoring your Consul 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 Consul 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_consul" {
	targets = [{
		__address__ = "localhost:8500",
		instance    = constants.hostname,
	}]
	forward_to = [prometheus.remote_write.metrics_service.receiver]
	job_name   = "integrations/consul"
	params     = {
		format = ["prometheus"],
	}
	metrics_path = "/v1/agent/metrics"

	authorization {
		type        = "Bearer"
		credentials = "<consul_acl_token>"
	}
}
```

To monitor your Consul instance, you must use a [discovery.relabel](/docs/alloy/latest/reference/components/discovery.relabel/) component to discover your Consul 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 Consul 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 Consul instance.
- `<consul_acl_token>`: change the bearer token according to the instructions given before.

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

### Advanced integrations snippets

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

```alloy
prometheus.exporter.consul "integrations_consul_exporter" {
	server = "localhost:8500"
}

discovery.relabel "integrations_consul_exporter" {
	targets = prometheus.exporter.consul.integrations_consul_exporter.targets

	rule {
		target_label = "instance"
		replacement  = constants.hostname
	}

	rule {
		target_label = "job"
		replacement  = "integrations/consul"
	}
}

prometheus.scrape "integrations_consul_exporter" {
	targets    = discovery.relabel.integrations_consul_exporter.output
	forward_to = [prometheus.remote_write.metrics_service.receiver]
	job_name   = "integrations/consul_exporter"
}
```

This integrations uses the [prometheus.exporter.consul](/docs/alloy/latest/reference/components/prometheus.exporter.consul/) component to generate metrics from a Consul instance.

For the full array of configuration options, refer to the [prometheus.exporter.consul](/docs/alloy/latest/reference/components/prometheus.exporter.consul/) component reference documentation.

This exporter must be linked with a [discovery.relabel](/docs/alloy/latest/reference/components/discovery.relabel/) component to apply the necessary relabelings.

For each Consul instance to be monitored you must create a pair of these components.

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

- `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 Consul instance.

You can then scrape them by including each `discovery.relabel` under `targets` within the [prometheus.scrape](/docs/alloy/latest/reference/components/prometheus.scrape/) component.

## Dashboards

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

- Consul Overview

**Consul Overview**

## Alerts

The Consul integration includes the following useful alerts:

Expand table

| Alert        | Description                           |
|--------------|---------------------------------------|
| ConsulUp     | Critical: Consul is not up.           |
| ConsulMaster | Critical: Consul has no master.       |
| ConsulPeers  | Critical: Consul does not have peers. |

## Metrics

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

- consul\_raft\_leader
- consul\_raft\_leader\_lastcontact\_count
- consul\_raft\_peers
- consul\_up
- up

## Changelog

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

```md
# 1.0.0 - December 2025

* Chore: Fix incorrect semver to 1.0.0. No further changes

# 0.0.5 - September 2023

* New Filter Metrics option for configuring the Grafana Agent, which saves on metrics cost by dropping any metric not used by this integration. Beware that anything custom built using metrics that are not on the snippet will stop working.
* New hostname relabel option, which applies the instance name you write on the text box to the Grafana Agent configuration snippets, making it easier and less error prone to configure this mandatory label.

# 0.0.4 - August 2023

* Expand with some optional Agent configuration snippets and supporting documentation

# 0.0.3 - June 2022

* Make job template variable multi-select

# 0.0.2 - October 2021

* Update all rate queries to use `$__rate_interval`, so they respect the default resolution

# 0.0.1 - December 2020

* Initial release
```

## Cost

By connecting your Consul 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/).
