HashiCorp Consul monitoring integration

The HashiCorp Consul integration reports data from your HashiCorp Consul environment to New Relic Infrastructure. This document explains how to install and configure the HashiCorp Consul integration and describes the data collected.

This integration is released as Open Source under the MIT license on GitHub. A change log is also available there for the latest updates.

Access to this feature depends on your subscription level. Requires Infrastructure Pro.

Features

The HashiCorp Consul on-host integration collects and sends inventory and metrics from your Consul environment to New Relic Infrastructure, where you can see the health of your Consul datacenter environment. Data is collected on both the datacenter and agent/node levels.

Compatibility and requirements

To use the HashiCorp Consul integration, ensure your system meets these requirements:

Install

On-host integrations do not automatically update. For best results, you should occasionally update the integration and update the Infrastructure agent.

To install the HashiCorp Consul integration:

  1. Follow the instructions for installing an integration, using the file name nri-consul.
  2. Via the command line, change directory to the integrations folder:
    cd /etc/newrelic-infra/integrations.d
  3. Create a copy of the sample configuration file by running:
    sudo cp consul-config.yml.sample consul-config.yml
  4. Edit the consul-config.yml configuration file using the configuration settings.
  5. Restart the infrastructure agent.

It is also possible to manually install integrations from a tarball file. For more information, see Install manually from a tarball archive.

Configure

Use the HashiCorp Consul integration's consul-config.yml configuration file to put required login credentials and configure how data is collected. For an example configuration, see the example config file.

Commands

The consul-config.yml file provides one command:

  • all_data: collects both inventory and metrics for the HashiCorp Consul environment.

Arguments

The consul-config.yml commands accept the following arguments:

  • hostname: The hostname or IP of a Consul node within the cluster. Defaults: localhost. Required.

  • port: Port to connect to node on. Default: 8500. Required.

  • fan_out: Whether to connect to other Consul agents to collect node data from them. Default: false.

  • token: ACL Token if token authentication is enabled.

  • enable_ssl: Whether or not to connect using SSL. Default: false.

  • trust_server_certificate: If set to true, server certificate is not verified for SSL. If set to false, certificate will be verified against supplied CA Bundles. Default: false.

  • ca_bundle_file: Alternative Certificate Authority bundle file, required if enable_ssl is set to true and trust_server_certificate is set to false.

  • ca_bundle_dir: Alternative Certificate Authority bundle directory, required if enable_ssl is set to true and trust_server_certificate is set to false.

Example consul-config.yml file configuration:

Example configuration
integration_name: com.newrelic.consul

instances:
  - name: consul-prod
    command: all_data
    arguments:
      hostname: consul-dev-0.consul.localnet
      token: my_token
    labels:
      env: production
      role: consul

Find and use data

To find your integration data in Infrastructure, go to infrastructure.newrelic.com > Third-party services and select one of the HashiCorp Consul integration links.

In New Relic Insights, HashiCorp Consul data is attached to the following Insights event type:

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.

These attributes can be found by querying the ConsulDatacenterSample event types in Insights.

Metric Description

consul.catalog.nodes_critical

The number of nodes with service status critical from those registered.

consul.catalog.nodes_passing

The number of nodes with service status passing from those registered.

consul.catalog.nodes_up

The number of nodes.

consul.catalog.nodes_warning

The number of nodes with service status warning from those registered.

consul.catalog.total_nodes

The number of nodes registered in the consul cluster.

consul.memberlist.msg.suspect

The number of times an agent suspects another as failed while probing during gossip protocol.

consul.raft.apply

The number of raft transactions occurring.

consul.raft.commitTime.avg

The average time it takes to commit a new entry to the raft log on the leader.

consul.raft.commitTime.count

The number of samples of raft.commitTime.

consul.raft.commitTime.max

The max time it takes to commit a new entry to the raft log on the leader.

consul.raft.commitTime.median

The median time it takes to commit a new entry to the raft log on the leader.

consul.raft.leader.dispatchLog.avg

The average time it takes for the leader to write log entries to disk.

consul.raft.leader.dispatchLog.count

The number of samples of raft.leader.dispatchLog.

consul.raft.leader.dispatchLog.max

The max time it takes for the leader to write log entries to disk.

consul.raft.leader.dispatchLog.median

The median time it takes for the leader to write log entries to disk.

consul.raft.leader.lastContact.avg

The average time elapsed since the leader was last able to check its lease with followers.

consul.raft.leader.lastContact.count

The number of samples of raft.leader.lastContact.

consul.raft.leader.lastContact.max

The max time elapsed since the leader was last able to check its lease with followers.

consul.raft.leader.lastContact.median

The median time elapsed since the leader was last able to check its lease with followers.

consul.raft.state.candidate

The number of initiated leader elections.

consul.raft.state.leader

The number of completed leader elections.

consul.serf.member.flap

The number of times an agent is marked dead and then quickly recovers.

These attributes can be found by querying the ConsulAgentSample event types in Insights.

Metric Description

agent.aclCacheHit

ACL cache hits.

agent.aclCacheMiss

ACL cache misses.

agent.kvStores

The number of samples of kvs.apply.

agent.kvStoresAvgInMilliseconds

The average time it takes to complete an update to the KV store.

agent.kvStoresMaxInMilliseconds

The max time it takes to complete an update to the KV store.

agent.kvStoresMedianInMilliseconds

The median time it takes to complete an update to the KV store.

agent.peers

The number of peers in the peer set.

agent.staleQueries

Served queries within the allowed stale threshold.

agent.txnAvgInMilliseconds

The average time it takes to apply a transaction operation.

agent.txnMaxInMilliseconds

The max time it takes to apply a transaction operation.

agent.txnMedianInMilliseconds

The median time it takes to apply a transaction operation.

agent.txns

The number of samples of txn.apply.

client.rpcFailed

Measure of failed RPC requests.

client.rpcLoad

Measure of how much an agent is loading Consul servers.

client.rpcRateLimited

Measure of RPC requests that get rate limited.

net.agent.maxLatencyInMilliseconds

Maximum latency from this node to all others.

net.agent.medianLatencyInMilliseconds

Median latency from this node to all others.

net.agent.minLatencyInMilliseconds

Minimum latency from this node to all others.

net.agent.p25LatencyInMilliseconds

P25 latency from this node to all others.

net.agent.p75LatencyInMilliseconds

P75 latency from this node to all others.

net.agent.p90LatencyInMilliseconds

P90 latency from this node to all others.

net.agent.p95LatencyInMilliseconds

P95 latency from this node to all others.

net.agent.p99LatencyInMilliseconds

P99 latency from this node to all others.

runtime.allocations

Cumulative count of heap objects allocated.

runtime.allocationsInBytes

The current bytes allocated by the Consul process.

runtime.frees

Cumulative count of heap objects freed.

runtime.gcCycles

The number of completed GC cycles.

runtime.gcPauseInMilliseconds

Cumulative nanoseconds in GC stop-the-world pauses since Consul started.

runtime.goroutines

The number of running go routines.

runtime.heapObjects

The number of objects allocated on the heap

runtime.virtualAddressSpaceInBytes

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.

Note: Nested sections within Config and DebugConfig are not collected.

The data is available on the Infrastructure Inventory page, under the config/consul source. For more about inventory data, see Understand integration data.

For more help