Use 'localhost' as default 'server' tag in zookeeper input (#4387)

(cherry picked from commit a82b4fbd96)
This commit is contained in:
Greg 2018-07-05 15:37:13 -06:00 committed by Daniel Nelson
parent 4be18c1ea2
commit 9b489a43eb
No known key found for this signature in database
GPG Key ID: CAAD59C9444F6155
3 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,17 @@
version: '3'
services:
zoo:
image: zookeeper
telegraf:
image: glinton/scratch
volumes:
- ./telegraf.conf:/telegraf.conf
- ../../../../telegraf:/telegraf
depends_on:
- zoo
entrypoint:
- /telegraf
- --config
- /telegraf.conf
network_mode: service:zoo

View File

@ -0,0 +1,9 @@
[agent]
interval="1s"
flush_interval="1s"
[[inputs.zookeeper]]
servers = [":2181"]
[[outputs.file]]
files = ["stdout"]

View File

@ -158,8 +158,14 @@ func (z *Zookeeper) gatherServer(ctx context.Context, address string, acc telegr
}
}
}
srv := "localhost"
if service[0] != "" {
srv = service[0]
}
tags := map[string]string{
"server": service[0],
"server": srv,
"port": service[1],
"state": zookeeper_state,
}