Skip to content

Commit

Permalink
Use 'localhost' as default 'server' tag in zookeeper input (#4387)
Browse files Browse the repository at this point in the history
  • Loading branch information
glinton authored and danielnelson committed Jul 5, 2018
1 parent f5f9fa2 commit a82b4fb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
17 changes: 17 additions & 0 deletions plugins/inputs/zookeeper/dev/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions plugins/inputs/zookeeper/dev/telegraf.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[agent]
interval="1s"
flush_interval="1s"

[[inputs.zookeeper]]
servers = [":2181"]

[[outputs.file]]
files = ["stdout"]
8 changes: 7 additions & 1 deletion plugins/inputs/zookeeper/zookeeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down

0 comments on commit a82b4fb

Please sign in to comment.