Skip to content

Commit

Permalink
Use datacenter option spelling in consul input (#5320)
Browse files Browse the repository at this point in the history
  • Loading branch information
marceloalmeida authored and danielnelson committed Jan 23, 2019
1 parent 39eff3d commit f739ce2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions etc/telegraf.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions plugins/inputs/consul/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 7 additions & 2 deletions plugins/inputs/consul/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type Consul struct {
Username string
Password string
Datacentre string
Datacenter string
tls.ClientConfig
TagDelimiter string

Expand All @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit f739ce2

Please sign in to comment.