Minor usability fixes to config

This commit is contained in:
Evan Phoenix
2015-05-18 15:22:04 -07:00
parent 82cbc4daa2
commit 13e6018eb0
4 changed files with 103 additions and 38 deletions

View File

@@ -94,11 +94,19 @@ func (g *Redis) Gather(acc plugins.Accumulator) error {
return outerr
}
const defaultPort = "6379"
func (g *Redis) gatherServer(addr string, acc plugins.Accumulator) error {
if g.c == nil {
_, _, err := net.SplitHostPort(addr)
if err != nil {
addr = addr + ":" + defaultPort
}
c, err := net.Dial("tcp", addr)
if err != nil {
return err
return fmt.Errorf("Unable to connect to redis server '%s': %s", addr, err)
}
g.c = c