Use 'localhost' as default 'server' tag in zookeeper input (#4387)
This commit is contained in:
parent
f5f9fa2095
commit
a82b4fbd96
|
@ -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
|
|
@ -0,0 +1,9 @@
|
|||
[agent]
|
||||
interval="1s"
|
||||
flush_interval="1s"
|
||||
|
||||
[[inputs.zookeeper]]
|
||||
servers = [":2181"]
|
||||
|
||||
[[outputs.file]]
|
||||
files = ["stdout"]
|
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue