Our HashiCorp Consul on-host integration collects and sends inventory and metrics from your Consul data center environment to New Relic, where you can see the health of your environment. We collect data on both the data center and agent/node levels.
Tip
Note that we also have a HashiCorp Cloud Platform Consul integration.
Compatibility and requirements
Before installation, ensure you meet these requirements:
- Our integration is compatible with HashiCorp Consul 1.0 or higher.
- If you're using ACL, the credentials for the Consul integration must have the policies
agent:read
,node:read
, andservice:read
.
Quick start
Instrument your Consul environment quickly and send your telemetry data with guided install. Our guided install uses our infrastructure agent and our CLI to set up the HashiCorp integration, and discovers other applications and log sources running in your environment and then recommends which ones you should instrument.
The guided install works with most setups. But if it doesn't suit your needs, there are other install options below.
Ready to get started? Click the relevant button, depending on which data center region you use. When you're done with the install, return to this documentation to review the configuration options.
Install
To install the HashiCorp Consul integration, follow the instructions for your environment:
Update your integration
This integration doesn't automatically update. For best results, regularly update the integration package and the infrastructure agent.
Post-installation tasks
When you're done with the install, you can set configuration options. Some configurations are required to get the integration to work, while some are optional.
Configure the integration
If you enabled this integration via our ECS or Kubernetes integration, see those docs:
For the standard on-host installation, this integration comes with a YAML config file, apache-config.yml
. This configuration is where you can place required login credentials and configure how data is collected. Which options you change depends on your setup and preferences. It comes with a sample config file apache-config.yml.sample
that you can copy and edit.
Specific settings related to Consul are defined using the env
section of the configuration file. These settings control the connection to your Consul instance as well as other security settings and features.
Important
If you are still using our legacy configuration/definition files, please refer to this document for help.
Consul configuration options
The Consul integration collects both metrics and inventory information. This table shows what each configuration option applies to.
Setting | Description | Default | Applies to |
---|---|---|---|
HOSTNAME | Hostname or IP where Consul is running. | localhost | M/I |
PORT | Port on which Consul is listening. | 8500 | M/I |
TOKEN | ACL Token if token authentication is enabled. | N/A | M/I |
ENABLE_SSL | Connect using SSL. | false | M/I |
CA_BUNDLE_FILE | Alternative Certificate Authority bundle file. | N/A | M/I |
CA_BUNDLE_DIR | Alternative Certificate Authority bundle directory. | N/A | M/I |
TRUST_SERVER_CERTIFICATE | If set to true, server certificate is NOT verified for SSL. | false | M/I |
FAN_OUT | If true will attempt to gather metrics from all other nodes in Consul cluster. | true | M |
CHECK_LEADERSHIP | Check leadership on consul server. This should be disabled on consul in client mode. | true | M |
TIMEOUT | Timeout for each of the consul client calls. | 30s | M/I |
METRICS | Set to | false | |
INVENTORY | Set to | false |
The values for these settings can be defined in several ways:
- Adding the value directly in the config file. This is the most common way.
- Replacing the values from environment variables using the
{{}}
notation. This requires infrastructure agent v1.14.0+. Read more here or see the example below. - Using secrets management. Use this to protect sensitive information, such as passwords that would be exposed in plain text on the configuration file. For more information, see Secrets management.
Labels
You can further decorate your metrics using labels. Labels allow you to add attributes (key/value pairs) to your metrics, which you can then use to query, filter, or group your metrics.
Our default sample config file includes examples of labels but, because they're not mandatory, you can remove, modify, or add new ones of your choice.
labels: env: production role: load_balancer
Example configurations
Find and use data
Data from this integration can be found by going to: one.newrelic.com > Infrastructure > Third-party services > Apache.
Apache data is attached to the ConsulDatacenterSample
and
ConsulAgentSample
event types. You can query this data for troubleshooting purposes or to create custom charts and dashboards.
For more on how to find and use your data, see Understand integration data.
Metric data
The HashiCorp Consul integration collects the following metric data attributes:
Consul data center sample metrics
These attributes are attached to the ConsulDatacenterSample
event type:
Metric | Description |
---|---|
| The number of nodes with service status |
| The number of nodes with service status |
| The number of nodes. |
| The number of nodes with service status |
| The number of nodes registered in the consul cluster. |
| The number of times an agent suspects another as failed while probing during gossip protocol. |
| The number of raft transactions occurring. |
| The average time it takes to commit a new entry to the raft log on the leader. |
| The number of samples of |
| The max time it takes to commit a new entry to the raft log on the leader. |
| The median time it takes to commit a new entry to the raft log on the leader. |
| The average time it takes for the leader to write log entries to disk. |
| The number of samples of |
| The max time it takes for the leader to write log entries to disk. |
| The median time it takes for the leader to write log entries to disk. |
| The average time elapsed since the leader was last able to check its lease with followers. |
| The number of samples of |
| The max time elapsed since the leader was last able to check its lease with followers. |
| The median time elapsed since the leader was last able to check its lease with followers. |
| The number of initiated leader elections. |
| The number of completed leader elections. |
| The number of times an agent is marked dead and then quickly recovers. |
Consul agent sample metrics
These attributes are attached to the ConsulAgentSample
event type:
Metric | Description |
---|---|
| ACL cache hits. |
| ACL cache misses. |
| The number of samples of |
| The average time it takes to complete an update to the KV store. |
| The max time it takes to complete an update to the KV store. |
| The median time it takes to complete an update to the KV store. |
| The number of peers in the peer set. |
| Served queries within the allowed stale threshold. |
| The average time it takes to apply a transaction operation. |
| The max time it takes to apply a transaction operation. |
| The median time it takes to apply a transaction operation. |
| The number of samples of |
| Measure of failed RPC requests. |
| Measure of how much an agent is loading Consul servers. |
| Measure of RPC requests that get rate limited. |
| Maximum latency from this node to all others. |
| Median latency from this node to all others. |
| Minimum latency from this node to all others. |
| P25 latency from this node to all others. |
| P75 latency from this node to all others. |
| P90 latency from this node to all others. |
| P95 latency from this node to all others. |
| P99 latency from this node to all others. |
| Cumulative count of heap objects allocated. |
| The current bytes allocated by the Consul process. |
| Cumulative count of heap objects freed. |
| The number of completed GC cycles. |
| Cumulative nanoseconds in GC stop-the-world pauses since Consul started. |
| The number of running go routines. |
| The number of objects allocated on the heap |
| Total size of the virtual address space reserved by the go runtime. |
Inventory data
The HashiCorp Consul integration captures the configuration parameters and current settings of the Consul Agent nodes. It collects the results of the /v1/agent/self
REST API endpoint. It pulls the Config
and DebugConfig
sections from that response.
Tip
Note: Nested sections within Config
and DebugConfig
are not collected.
The data is available on the Inventory page, under the config/consul source. For more about inventory data, see Understand integration data.
Check the source code
This integration is open source software. That means you can browse its source code and send improvements, or create your own fork and build it.