2018-03-27 02:22:17 +00:00
# Consul Input Plugin
2016-06-01 10:02:28 +00:00
2018-03-27 02:22:17 +00:00
This plugin will collect statistics about all health checks registered in the
Consul. It uses [Consul API ](https://www.consul.io/docs/agent/http/health.html#health_state )
to query the data. It will not report the
[telemetry ](https://www.consul.io/docs/agent/telemetry.html ) but Consul can
report those stats already using StatsD protocol if needed.
2016-06-01 10:02:28 +00:00
2018-03-27 02:22:17 +00:00
### Configuration:
2016-06-01 10:02:28 +00:00
2018-03-27 02:22:17 +00:00
```toml
2016-06-01 10:02:28 +00:00
# Gather health check statuses from services registered in Consul
[[inputs.consul]]
2018-03-27 02:22:17 +00:00
## Consul server address
2020-01-15 00:24:14 +00:00
# address = "localhost:8500"
2018-03-27 02:22:17 +00:00
## URI scheme for the Consul server, one of "http", "https"
# scheme = "http"
## ACL token used in every request
2016-06-01 10:02:28 +00:00
# token = ""
2018-03-27 02:22:17 +00:00
## HTTP Basic Authentication username and password.
2016-06-01 10:02:28 +00:00
# username = ""
# password = ""
2019-01-23 22:10:38 +00:00
## Data center to query the health checks from
# datacenter = ""
2016-06-01 10:02:28 +00:00
2018-05-04 23:33:23 +00:00
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
2018-03-27 02:22:17 +00:00
# insecure_skip_verify = true
2018-05-17 21:24:51 +00:00
## Consul checks' tag splitting
# When tags are formatted like "key:value" with ":" as a delimiter then
# they will be splitted and reported as proper key:value in Telegraf
# tag_delimiter = ":"
2018-03-27 02:22:17 +00:00
```
2016-06-01 10:02:28 +00:00
2018-03-27 02:22:17 +00:00
### Metrics:
- consul_health_checks
- tags:
- node (node that check/service is registred on)
- service_name
- check_id
- fields:
- check_name
- service_id
- status
- passing (integer)
- critical (integer)
- warning (integer)
2017-01-29 00:47:25 +00:00
`passing` , `critical` , and `warning` are integer representations of the health
check state. A value of `1` represents that the status was the state of the
the health check at this sample.
2016-06-01 10:02:28 +00:00
## Example output
```
2018-03-27 02:22:17 +00:00
consul_health_checks,host=wolfpit,node=consul-server-node,check_id="serfHealth" check_name="Serf Health Status",service_id="",status="passing",passing=1i,critical=0i,warning=0i 1464698464486439902
consul_health_checks,host=wolfpit,node=consul-server-node,service_name=www.example.com,check_id="service:www-example-com.test01" check_name="Service 'www.example.com' check",service_id="www-example-com.test01",status="critical",passing=0i,critical=1i,warning=0i 1464698464486519036
2016-06-01 10:02:28 +00:00
```