From b187ffc55fc8667919e35b09dedc965ce340039a Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Mon, 26 Mar 2018 19:22:17 -0700 Subject: [PATCH] Add documentation for existing TLS settings in consul input (#3931) --- plugins/inputs/consul/README.md | 73 ++++++++++++++++++--------------- plugins/inputs/consul/consul.go | 23 +++++++---- 2 files changed, 57 insertions(+), 39 deletions(-) diff --git a/plugins/inputs/consul/README.md b/plugins/inputs/consul/README.md index 29027805b..7e68a4931 100644 --- a/plugins/inputs/consul/README.md +++ b/plugins/inputs/consul/README.md @@ -1,43 +1,54 @@ -# Telegraf Input Plugin: Consul +# Consul Input Plugin -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. +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. -## Configuration: +### Configuration: -``` +```toml # Gather health check statuses from services registered in Consul [[inputs.consul]] - ## Most of these values defaults to the one configured on a Consul's agent level. - ## Optional Consul server address (default: "") - # address = "" - ## Optional URI scheme for the Consul server (default: "") - # scheme = "" - ## Optional ACL token used in every request (default: "") + ## Consul server address + # address = "localhost" + + ## URI scheme for the Consul server, one of "http", "https" + # scheme = "http" + + ## ACL token used in every request # token = "" - ## Optional username used for request HTTP Basic Authentication (default: "") + + ## HTTP Basic Authentication username and password. # username = "" - ## Optional password used for HTTP Basic Authentication (default: "") # password = "" - ## Optional data centre to query the health checks from (default: "") + + ## Data centre to query the health checks from # datacentre = "" + + ## SSL Config + # ssl_ca = "/etc/telegraf/ca.pem" + # ssl_cert = "/etc/telegraf/cert.pem" + # ssl_key = "/etc/telegraf/key.pem" + ## If false, skip chain & host verification + # insecure_skip_verify = true ``` -## Measurements: +### Metrics: -### Consul: -Tags: -- node: on which node check/service is registered on -- service_name: name of the service (this is the service name not the service ID) -- check_id - -Fields: -- check_name -- service_id -- status -- passing -- critical -- warning +- 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) `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 @@ -46,8 +57,6 @@ the health check at this sample. ## Example output ``` -$ telegraf --config ./telegraf.conf --input-filter consul --test -* Plugin: consul, Collection 1 -> 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 +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 ``` diff --git a/plugins/inputs/consul/consul.go b/plugins/inputs/consul/consul.go index 45612a928..bfd9b4340 100644 --- a/plugins/inputs/consul/consul.go +++ b/plugins/inputs/consul/consul.go @@ -31,19 +31,28 @@ type Consul struct { } var sampleConfig = ` - ## Most of these values defaults to the one configured on a Consul's agent level. - ## Optional Consul server address (default: "localhost") + ## Consul server address # address = "localhost" - ## Optional URI scheme for the Consul server (default: "http") + + ## URI scheme for the Consul server, one of "http", "https" # scheme = "http" - ## Optional ACL token used in every request (default: "") + + ## ACL token used in every request # token = "" - ## Optional username used for request HTTP Basic Authentication (default: "") + + ## HTTP Basic Authentication username and password. # username = "" - ## Optional password used for HTTP Basic Authentication (default: "") # password = "" - ## Optional data centre to query the health checks from (default: "") + + ## Data centre to query the health checks from # datacentre = "" + + ## SSL Config + # ssl_ca = "/etc/telegraf/ca.pem" + # ssl_cert = "/etc/telegraf/cert.pem" + # ssl_key = "/etc/telegraf/key.pem" + ## If false, skip chain & host verification + # insecure_skip_verify = true ` func (c *Consul) Description() string {