Consul

Note

This plugin is currently being groomed to be an integration. It works, but we haven’t spent a lot of time on it yet to optimize the user experience. Feel free to try it out, just keep in mind that we will be enhancing the experience over time.

Consul is a tool for discovering and configuring services in your infrastructure. It provides several key features including Service Discovery, Health Checking, a KV Store, and support for Multiple Datacenters.

Setup

The consul plugin is included with the AppOptics host agent by default, please follow the directions below to enable it for a host agent instance.

Prerequisites

The Consul agent must be started beforehand and services you are interested in performing health checks for must be registered to it.

Please visit the Consul website for more information.

Configuration

The host agent provides an example configuration file to help you get started quickly. It defines the plugin and task file to be loaded by the agent. To enable the plugin:

  1. Make a copy of the Consul example configuration file /opt/appoptics/etc/plugins.d/consul.yaml.example, renaming it to /opt/appoptics/etc/plugins.d/consul.yaml:
$ sudo cp /opt/appoptics/etc/plugins.d/consul.yaml.example /opt/appoptics/etc/plugins.d/consul.yaml
  1. Update the /opt/appoptics/etc/plugins.d/consul.yaml configuration file to set which metrics to report, for example:
collector:
  consul:
    all:
      ## Most of these values defaults to the one configured on a Consul's agent level.
      ## Optional Consul server address (default: "localhost")
      # address: "localhost"
      ## Optional URI scheme for the Consul server (default: "http")
      # scheme: "http"
      ## Optional ACL token used in every request (default: "")
      # token: ""
      ## Optional username used for request HTTP Basic Authentication (default: "")
      # username: ""
      ## Optional password used for HTTP Basic Authentication (default: "")
      # password: ""
      ## Optional data centre to query the health checks from (default: "")
      # datacentre: ""

load:
  plugin: snap-plugin-collector-bridge-consul
  task: task-bridge-consul.yaml
  1. Restart the host agent:
$ sudo service appoptics-snapteld restart
  1. Enable the Consul plugin in AppOptics

    On the Integrations Page you will see the Consul plugin available if the previous steps were successful. If you do not see the plugin, see Troubleshooting.

    Select the Consul plugin to open the configuration menu in the UI, and enable the plugin.

Snaptel fails to start after adding consul config

If you’re seeing errors after restarting the appoptics-snapteld service, you may need to change the address setting in the /opt/appoptics/etc/plugins.d/consul.yaml file.

By default, the plugin will attempt to query the consul service on localhost (often 127.0.0.1:80), but the consul agent itself runs on 127.0.0.1:8500 by default.

After making the change, restart the service:

$ sudo service appoptics-snapteld restart

Default Metrics

The Consul plugin collects all statistics about the health checks registered to the agent by querying the Consul API. Telemetry statistics are also available which you can collect using the StatsD protocol if needed.

Namespace Description
consul.consul_health_checks.check_name Name of the check/sample
consul.consul_health_checks.service_id ID of the service
consul.consul_health_checks.status Name of health check state (one of passing, critical, warning)
consul.consul_health_checks.passing Integer representation of health check state - a value of 1 indicates this was the status at time of sampling
consul.consul_health_checks.critical Integer representation of health check state - a value of 1 indicates this was the status at time of sampling
consul.consul_health_checks.warning Integer representation of health check state - a value of 1 indicates this was the status at time of sampling

Tags

The table below outlines the default set of tags provided for each metric.

Tag Name Description
node Which node the check/service is registered on
service_name Name of the service
check_id ID of the check/sample
hostname Name of the host. Instead of using this tag we recommend using the @host alias.