Gather stats from PG and redis from localhost by default

This commit is contained in:
Evan Phoenix 2015-05-18 11:53:57 -07:00
parent 4d0784a64d
commit 60a49243cf
2 changed files with 16 additions and 4 deletions

View File

@ -17,7 +17,14 @@ type Postgresql struct {
Servers []*Server
}
var localhost = &Server{Address: "sslmode=disable"}
func (p *Postgresql) Gather(acc plugins.Accumulator) error {
if len(p.Servers) == 0 {
p.gatherServer(localhost, acc)
return nil
}
for _, serv := range p.Servers {
err := p.gatherServer(serv, acc)
if err != nil {

View File

@ -63,10 +63,6 @@ func (g *Redis) Gather(acc plugins.Accumulator) error {
return nil
}
var wg sync.WaitGroup
var outerr error
var servers []string
if g.Address != "" {
@ -75,6 +71,15 @@ func (g *Redis) Gather(acc plugins.Accumulator) error {
servers = append(servers, g.Servers...)
if len(servers) == 0 {
g.gatherServer(":6379", acc)
return nil
}
var wg sync.WaitGroup
var outerr error
for _, serv := range servers {
wg.Add(1)
go func(serv string) {