fix "password contains '@'" bug

https://github.com/influxdb/telegraf/issues/297
This commit is contained in:
cornerot 2015-10-22 11:11:08 +03:00
parent 2f08577967
commit a60977710b
1 changed files with 2 additions and 1 deletions

View File

@ -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 {