From a60977710b86bdbc37234ef7a7fc804033cd4b37 Mon Sep 17 00:00:00 2001 From: cornerot Date: Thu, 22 Oct 2015 11:11:08 +0300 Subject: [PATCH] fix "password contains '@'" bug https://github.com/influxdb/telegraf/issues/297 --- plugins/mysql/mysql.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/mysql/mysql.go b/plugins/mysql/mysql.go index 89c4c9b44..6e092dcdf 100644 --- a/plugins/mysql/mysql.go +++ b/plugins/mysql/mysql.go @@ -132,7 +132,8 @@ func (m *Mysql) gatherServer(serv string, acc plugins.Accumulator) error { // Parse out user/password from server address tag if given var servtag string if strings.Contains(serv, "@") { - servtag = strings.Split(serv, "@")[1] + servSplit := strings.Split(serv, "@") + servtag = servSplit[len(servSplit) - 1] //last item } else if serv == "" { servtag = "localhost" } else {