Use 'localhost' as default 'server' tag in zookeeper input (#4387)
(cherry picked from commit a82b4fbd96
)
This commit is contained in:
parent
4be18c1ea2
commit
9b489a43eb
|
@ -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