• Stars
    star
    436
  • Rank 99,877 (Top 2 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created almost 10 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Exporter for Consul metrics

Consul Exporter

CircleCI Docker Repository on Quay Docker Pulls

Export Consul service health to Prometheus.

To run it:

make
./consul_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_serf_lan_member_status Status of member in the cluster. 1=Alive, 2=Leaving, 3=Left, 4=Failed. member
consul_serf_wan_member_status Status of member in the wan cluster. 1=Alive, 2=Leaving, 3=Left, 4=Failed. member, dc
consul_catalog_services How many services are in the cluster
consul_service_tag Tags of a service. service_id, node, tag
consul_catalog_service_node_healthy Is this service healthy on this node service_id, node, service_name
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_id, service_name, status
consul_catalog_kv The values for selected keys in Consul's key/value catalog. Keys with non-numeric values are omitted key
consul_service_checks Link the Consul service ID with check name if available service_id,service_name, check_id, check_name, node

Flags

./consul_exporter --help
  • consul.allow_stale: Allows any Consul server (non-leader) to service a read.
  • consul.ca-file: File path to a PEM-encoded certificate authority used to validate the authenticity of a server certificate.
  • consul.cert-file: File path to a PEM-encoded certificate used with the private key to verify the exporter's authenticity.
  • consul.health-summary: Collects information about each registered service and exports consul_catalog_service_node_healthy. This requires n+1 Consul API queries to gather all information about each service. Health check information are available via consul_health_service_status as well, but only for services which have a health check configured. Defaults to true. Disable using --no-consul.heatlh-summary.
  • consul.key-file: File path to a PEM-encoded private key used with the certificate to verify the exporter's authenticity.
  • consul.insecure: Disable TLS host verification.
  • consul.require_consistent: Forces the read to be fully consistent.
  • consul.server: Address (host and port) of the Consul instance we should connect to. This could be a local agent (localhost:8500, for instance), or the address of a Consul server.
  • consul.server-name: When provided, this overrides the hostname for the TLS certificate. It can be used to ensure that the certificate name matches the hostname we declare.
  • consul.timeout: Timeout on HTTP requests to consul.
  • consul.request-limit: Limit the maximum number of concurrent requests to consul, 0 means no limit.
  • log.format: Set the log target and format. Example: logger:syslog?appname=bob&local=7 or logger:stdout?json=true
  • log.level: Logging level. info by default.
  • web.listen-address: Address to listen on for web interface and telemetry.
  • web.telemetry-path: Path under which to expose metrics.
  • version: Show application version.

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.

  • kv.filter: Only store keys that match this regex pattern.
  • kv.prefix: Prefix under which to look for KV pairs.

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:

docker pull prom/consul-exporter

docker 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:

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

TLS and basic authentication

The consul_exporter supports TLS and basic authentication. To use TLS and/or basic authentication, you need to pass a configuration file using the --web.config.file parameter. The format of the file is described in the exporter-toolkit repository.

More Repositories

1

prometheus

The Prometheus monitoring system and time series database.
Go
54,496
star
2

node_exporter

Exporter for machine metrics
Go
10,870
star
3

alertmanager

Prometheus Alertmanager
Go
6,540
star
4

client_golang

Prometheus instrumentation library for Go applications
Go
5,367
star
5

blackbox_exporter

Blackbox prober exporter
Go
4,532
star
6

client_python

Prometheus instrumentation library for Python applications
Python
3,914
star
7

jmx_exporter

A process for exposing JMX Beans via HTTP for Prometheus consumption
Java
3,005
star
8

pushgateway

Push acceptor for ephemeral and batch jobs.
Go
2,969
star
9

client_java

Prometheus instrumentation library for JVM applications
Java
2,166
star
10

mysqld_exporter

Exporter for MySQL server metrics
Go
2,097
star
11

snmp_exporter

SNMP Exporter for Prometheus
Go
1,634
star
12

statsd_exporter

StatsD to Prometheus metrics exporter
Go
912
star
13

cloudwatch_exporter

Metrics exporter for Amazon AWS CloudWatch
Java
892
star
14

procfs

procfs provides functions to retrieve system, kernel and process metrics from the pseudo-filesystem proc.
Go
767
star
15

docs

Prometheus documentation: content and static site generator
SCSS
645
star
16

haproxy_exporter

Simple server that scrapes HAProxy stats and exports them via HTTP for Prometheus consumption
Go
615
star
17

promlens

PromLens – The query builder, analyzer, and explainer for PromQL
TypeScript
552
star
18

client_ruby

Prometheus instrumentation library for Ruby applications
Ruby
510
star
19

client_rust

Prometheus / OpenMetrics client library in Rust
Rust
462
star
20

prom2json

A tool to scrape a Prometheus client and dump the result as JSON.
Go
364
star
21

graphite_exporter

Server that accepts metrics via the Graphite protocol and exports them as Prometheus metrics
Go
350
star
22

promu

Prometheus Utility Tool
Go
268
star
23

influxdb_exporter

A server that accepts InfluxDB metrics via the HTTP API and exports them via HTTP for Prometheus consumption
Go
261
star
24

exporter-toolkit

Utility package to build exporters
Go
261
star
25

common

Go libraries shared across Prometheus components and libraries.
Go
261
star
26

collectd_exporter

A server that accepts collectd stats via HTTP POST and exports them via HTTP for Prometheus consumption
Go
255
star
27

memcached_exporter

Exports metrics from memcached servers for consumption by Prometheus.
Go
182
star
28

test-infra

Prometheus E2E benchmarking tool
Go
153
star
29

compliance

A set of tests to check compliance with various Prometheus interfaces
Go
127
star
30

nagios_plugins

Nagios plugins for alerting on Prometheus query results
Shell
103
star
31

demo-site

Demo site auto-deployed with Ansible and Travis CI.
HTML
96
star
32

client_model

Data model artifacts for Prometheus.
Makefile
74
star
33

golang-builder

Prometheus Golang builder Docker images
Shell
69
star
34

codemirror-promql

PromQL support for the CodeMirror code editor
TypeScript
39
star
35

busybox

Prometheus Busybox Docker base images
Makefile
37
star
36

prometheus_api_client_ruby

A Ruby library for reading metrics stored on a Prometheus server
Ruby
36
star
37

talks

Track Prometheus talks
20
star
38

lezer-promql

A lezer-based PromQL grammar
JavaScript
12
star
39

proposals

Design documents for Prometheus Ecosystem
Makefile
9
star
40

host_exporter

See the "node_exporter" repository instead!
8
star
41

circleci

7
star
42

snmp_exporter_mibs

4
star
43

promci

GitHub Actions repository
4
star
44

kube-demo-site

Kubernetes Demo Site
Go
1
star
45

client_java-benchmarks

1
star
46

sigv4

A http.RoundTripper that will sign requests using Amazon's Signature Verification V4 signing procedure
1
star