From 2af97cdbcbe4efe16194b473ce760e90b30e6191 Mon Sep 17 00:00:00 2001 From: Nicholas Katsaros Date: Mon, 9 Nov 2015 21:56:28 -0500 Subject: [PATCH] redis: support IPv6 addresses with no port closes #356 --- CHANGELOG.md | 1 + plugins/redis/redis.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5853ac28..1c2142857 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ changed to just run docker commands in the Makefile. See `make docker-run` and ### Bugfixes - [#331](https://github.com/influxdb/telegraf/pull/331): Dont overwrite host tag in redis plugin. - [#336](https://github.com/influxdb/telegraf/pull/336): Mongodb plugin should take 2 measurements. +- [#356](https://github.com/influxdb/telegraf/pull/356): Redis plugin IPv6 fix. Thanks @nkatsaros! ## v0.2.0 [2015-10-27] diff --git a/plugins/redis/redis.go b/plugins/redis/redis.go index 95d5dc75b..f15d9557b 100644 --- a/plugins/redis/redis.go +++ b/plugins/redis/redis.go @@ -114,7 +114,7 @@ const defaultPort = "6379" func (r *Redis) gatherServer(addr *url.URL, acc plugins.Accumulator) error { _, _, err := net.SplitHostPort(addr.Host) if err != nil { - addr.Host = addr.Host + ":" + defaultPort + addr.Host = net.JoinHostPort(addr.Host, defaultPort) } c, err := net.Dial("tcp", addr.Host)