diff --git a/etc/telegraf.conf b/etc/telegraf.conf index 161754f6f..c6f679952 100644 --- a/etc/telegraf.conf +++ b/etc/telegraf.conf @@ -1703,8 +1703,8 @@ # # username = "" # # password = "" # -# ## Data centre to query the health checks from -# # datacentre = "" +# ## Data center to query the health checks from +# # datacenter = "" # # ## Optional TLS Config # # tls_ca = "/etc/telegraf/ca.pem" diff --git a/plugins/inputs/consul/README.md b/plugins/inputs/consul/README.md index f7dcdf362..2b2368388 100644 --- a/plugins/inputs/consul/README.md +++ b/plugins/inputs/consul/README.md @@ -24,8 +24,8 @@ report those stats already using StatsD protocol if needed. # username = "" # password = "" - ## Data centre to query the health checks from - # datacentre = "" + ## Data center to query the health checks from + # datacenter = "" ## Optional TLS Config # tls_ca = "/etc/telegraf/ca.pem" diff --git a/plugins/inputs/consul/consul.go b/plugins/inputs/consul/consul.go index 8649184dd..a3543f406 100644 --- a/plugins/inputs/consul/consul.go +++ b/plugins/inputs/consul/consul.go @@ -17,6 +17,7 @@ type Consul struct { Username string Password string Datacentre string + Datacenter string tls.ClientConfig TagDelimiter string @@ -38,8 +39,8 @@ var sampleConfig = ` # username = "" # password = "" - ## Data centre to query the health checks from - # datacentre = "" + ## Data center to query the health checks from + # datacenter = "" ## Optional TLS Config # tls_ca = "/etc/telegraf/ca.pem" @@ -77,6 +78,10 @@ func (c *Consul) createAPIClient() (*api.Client, error) { config.Datacenter = c.Datacentre } + if c.Datacenter != "" { + config.Datacenter = c.Datacenter + } + if c.Token != "" { config.Token = c.Token }