2018-03-27 10:22:17 +08:00
# Consul Input Plugin
2016-06-01 18:02:28 +08:00
2018-03-27 10:22:17 +08:00
This plugin will collect statistics about all health checks registered in the
2022-06-08 05:10:18 +08:00
Consul. It uses [Consul API][1] to query the data. It will not report the
[telemetry][2] but Consul can report those stats already using StatsD protocol
if needed.
[1]: https://www.consul.io/docs/agent/http/health.html#health_state
[2]: https://www.consul.io/docs/agent/telemetry.html
2016-06-01 18:02:28 +08:00
2022-10-27 03:58:36 +08:00
## Global configuration options <!-- @/docs/includes/plugin_config.md -->
In addition to the plugin-specific configuration settings, plugins support
additional global and plugin configuration settings. These settings are used to
modify metrics, tags, and field or create aliases and configure ordering, etc.
See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
2023-01-12 23:55:21 +08:00
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md#plugins
2022-10-27 03:58:36 +08:00
2021-11-25 02:55:55 +08:00
## Configuration
2016-06-01 18:02:28 +08:00
2022-05-24 21:49:47 +08:00
```toml @sample .conf
2016-06-01 18:02:28 +08:00
# Gather health check statuses from services registered in Consul
[[inputs.consul]]
2018-03-27 10:22:17 +08:00
## Consul server address
2020-01-15 08:24:14 +08:00
# address = "localhost:8500"
2018-03-27 10:22:17 +08:00
## URI scheme for the Consul server, one of "http", "https"
# scheme = "http"
2020-10-07 23:31:02 +08:00
## Metric version controls the mapping from Consul metrics into
## Telegraf metrics. Version 2 moved all fields with string values
## to tags.
##
## example: metric_version = 1; deprecated in 1.16
## metric_version = 2; recommended version
# metric_version = 1
2018-03-27 10:22:17 +08:00
## ACL token used in every request
2016-06-01 18:02:28 +08:00
# token = ""
2018-03-27 10:22:17 +08:00
## HTTP Basic Authentication username and password.
2016-06-01 18:02:28 +08:00
# username = ""
# password = ""
2019-01-24 06:10:38 +08:00
## Data center to query the health checks from
# datacenter = ""
2016-06-01 18:02:28 +08:00
2018-05-05 07:33:23 +08: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 10:22:17 +08:00
# insecure_skip_verify = true
2018-05-18 05:24:51 +08:00
## Consul checks' tag splitting
# When tags are formatted like "key:value" with ":" as a delimiter then
2024-01-06 05:34:02 +08:00
# they will be split and reported as proper key:value in Telegraf
2018-05-18 05:24:51 +08:00
# tag_delimiter = ":"
2018-03-27 10:22:17 +08:00
```
2016-06-01 18:02:28 +08:00
2021-11-25 02:55:55 +08:00
## Metrics
### metric_version = 1
2018-03-27 10:22:17 +08:00
- consul_health_checks
- tags:
2021-11-25 02:55:55 +08:00
- node (node that check/service is registered on)
- service_name
- check_id
2018-03-27 10:22:17 +08:00
- fields:
- check_name
- service_id
- status
- passing (integer)
- critical (integer)
- warning (integer)
2017-01-29 08:47:25 +08:00
2021-11-25 02:55:55 +08:00
### metric_version = 2
2020-10-07 23:31:02 +08:00
- consul_health_checks
- tags:
2021-11-25 02:55:55 +08:00
- node (node that check/service is registered on)
- service_name
- check_id
- check_name
2020-10-07 23:31:02 +08:00
- service_id
- status
- fields:
- passing (integer)
- critical (integer)
- warning (integer)
2021-11-25 02:55:55 +08:00
2017-01-29 08:47:25 +08:00
`passing` , `critical` , and `warning` are integer representations of the health
2023-05-22 20:14:01 +08:00
check state. A value of `1` represents that the status was the state of the
2022-06-08 05:10:18 +08:00
health check at this sample. `status` is string representation of the same
state.
2016-06-01 18:02:28 +08:00
2022-06-08 05:10:18 +08:00
## Example Output
2016-06-01 18:02:28 +08:00
2023-04-04 19:43:49 +08:00
```text
2018-03-27 10:22:17 +08: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 18:02:28 +08:00
```