This commit is contained in:
Adithya Benny 2015-10-22 21:11:15 +00:00
commit c3760b84f0
1 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package mysql
import ( import (
"database/sql" "database/sql"
"regexp"
"strconv" "strconv"
"strings" "strings"
@ -132,7 +133,8 @@ func (m *Mysql) gatherServer(serv string, acc plugins.Accumulator) error {
// Parse out user/password from server address tag if given // Parse out user/password from server address tag if given
var servtag string var servtag string
if strings.Contains(serv, "@") { if strings.Contains(serv, "@") {
servtag = strings.Split(serv, "@")[1] r, _ := regexp.Compile("(.*)[:](.*)[@]([a-z]+)[(|:][/]*(.*)[:]([0-9]+)[)]?[/]([^?]*)[?]?([^?]*)")
servtag = r.FindStringSubmatch(serv)[4]
} else if serv == "" { } else if serv == "" {
servtag = "localhost" servtag = "localhost"
} else { } else {