Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 'localhost' as default 'server' tag #4387

Merged
merged 1 commit into from
Jul 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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