• EnglishEspañol日本語한국어Português
  • Log inStart now

Collector for monitoring HCP Consul metrics

This guide explains how to collect metrics from your HCP-managed Consul deployment using the OpenTelemetry Collector. The collector gathers, processes, and sends telemetry data (including metrics, logs, and traces) to various observability backends, including New Relic.

The setup example below leverages the Prometheus receiver within the collector. It retrieves service metrics directly from HCP Consul's service metrics API and exports them to New Relic's OpenTelemetry endpoint.

HCP Consul offers two types of observability metrics:

Follow the steps below to collect and export HCP Consul metrics to New Relic.

Review the requirements

Before you start, you'll need the following:

  • A running Docker daemon service
  • An installed Docker Compose tool
  • Your HCP Consul ACL admin token
  • Your New Relic for the account you want to report data to

Download or clone the example configuration

  1. Download the example Configuration.
  2. Once downloaded, locate the directory named hcp-consul within the other-examples/collector folder of the repository. This directory contains the specific configuration for collecting HCP Consul metrics.
  3. (Optional) Refer to the README for additional details and instructions related to the HCP Consul example.

Set environment variables and run the collector

In the .env file:

  • Set the HCP Access Token and Access URL values
  • Set the New Relic API key variable to your New Relic license key
# Open the HCP Consul example directory
cd newrelic-opentelemetry-examples/other-examples/collector/hcp-consul
# Set environment variables.
# run the collector in docker
docker compose up

Environment variable information

If you need more information on the environment variables set above, see the documentation in the following table.





New Relic Ingest API Key

Learn about API keys


The default US New Relic OTLP endpoint is https://otlp.nr-data.net:4318.

Review OTLP endpoint configurations


ACL Admin token for HCP Consul

Create an ACL admin token


URL to access your specific Consul server

Locate your access URL

Forward HCP Consul Envoy metrics to New Relic

To monitor HCP Consul Envoy metrics in New Relic, you can configure the OpenTelemetry collector built into your HCP Consul cluster to forward metrics to your own collector. This can include the collector running in this example.

  1. Add an HTTP receiver to the OpenTelemetry collector. You can add this into the receivers group in the example collector.yaml file:


    This will add a receiver listening at

  2. Configure your HCP Consul cluster to forward Envoy metrics to this receiver. This can be configured from the telemetryCollector stanza in your HCP Consul configuration file. For example:

    enabled: true
    customExporterConfig: |-
    "exporter_config": {
    "otlphttp": {
    "endpoint": "",
    "headers": {
    "authorization": "<auth>"
    "timeout": "2s"

View your data in New Relic

In New Relic, you can view your HCP Consul data in a few different places:

  • Navigate to the New Relic marketplace and search for "consul". Click one of the dashboards to quickly install it for your account.

  • Navigate to the metrics explorer and filter for consul, or envoy for Envoy metrics. This data can be added to any custom alert or dashboard.


    To view all metrics available with this HCP Consul server integration, reference the documentation here.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.