prometheus/consul_exporter

Name: consul_exporter

Owner: Prometheus

Description: Exporter for Consul metrics

Created: 2015-03-18 17:42:22.0

Updated: 2018-05-07 13:23:19.0

Pushed: 2018-05-24 14:40:39.0

Homepage: null

Size: 1640

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Consul Exporter Build Status

CircleCI Docker Repository on Quay Docker Pulls

Export Consul service health to Prometheus.

To run it:


nsul_exporter [flags]
Exported Metrics

| Metric | Meaning | Labels | | —— | ——- | —— | | consul_up | Was the last query of Consul successful | | | consul_raft_peers | How many peers (servers) are in the Raft cluster | | | consul_serf_lan_members | How many members are in the cluster | | | consul_catalog_services | How many services are in the cluster | | | consul_catalog_service_node_healthy | Is this service healthy on this node | service, node | | consul_health_node_status | Status of health checks associated with a node | check, node, status | | consul_health_service_status | Status of health checks associated with a service | check, node, service, status | | consul_catalog_kv | The values for selected keys in Consul's key/value catalog. Keys with non-numeric values are omitted | key |

Flags
nsul_exporter --help
Key/Value Checks

This exporter supports grabbing key/value pairs from Consul's KV store and exposing them to Prometheus. This can be useful, for instance, if you use Consul KV to store your intended cluster size, and want to graph that value against the actual value found via monitoring.

A prefix must be supplied to activate this feature. Pass / if you want to search the entire keyspace.

Environment variables

The consul_exporter supports all environment variables provided by the official consul/api package, including CONSUL_HTTP_TOKEN to set the ACL token.

Useful Queries

Are my services healthy?

min(consul_catalog_service_node_healthy) by (service_name)

Values of 1 mean that all nodes for the service are passing. Values of 0 mean at least one node for the service is not passing.

What service nodes are failing?

sum by (node, service_name)(consul_catalog_service_node_healthy == 0)

What service checks are critical?

consul_health_service_status{status="critical"} == 1

You can query for the following health check states: “maintenance”, “critical”, “warning” or “passing”

Using Docker

You can deploy this exporter using the prom/consul-exporter Docker image.

For example:

er pull prom/consul-exporter

er run -d -p 9107:9107 prom/consul-exporter --consul.server=172.17.0.1:8500

Keep in mind that your container needs to be able to communicate with the Consul server or agent. Use an IP accessible from the container or set the --dns and --dns-search options of the docker run command:

er run -d -p 9107:9107 --dns=172.17.0.1 --dns-search=service.consul \
    prom/consul-exporter --consul.server=consul:8500

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.