Gather stats from PG and redis from localhost by default
This commit is contained in:
parent
4d0784a64d
commit
60a49243cf
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue