Skip to content

Commit

Permalink
Gather IPMI metrics concurrently from list of servers (influxdata#4352)
Browse files Browse the repository at this point in the history
  • Loading branch information
glinton authored and rgitzel committed Oct 17, 2018
1 parent e25c02f commit d35b37e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions plugins/inputs/ipmi_sensor/ipmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os/exec"
"strconv"
"strings"
"sync"
"time"

"github.com/influxdata/telegraf"
Expand Down Expand Up @@ -61,13 +62,18 @@ func (m *Ipmi) Gather(acc telegraf.Accumulator) error {
}

if len(m.Servers) > 0 {
wg := sync.WaitGroup{}
for _, server := range m.Servers {
err := m.parse(acc, server)
if err != nil {
acc.AddError(err)
continue
}
wg.Add(1)
go func(a telegraf.Accumulator, s string) {
defer wg.Done()
err := m.parse(a, s)
if err != nil {
a.AddError(err)
}
}(acc, server)
}
wg.Wait()
} else {
err := m.parse(acc, "")
if err != nil {
Expand Down

0 comments on commit d35b37e

Please sign in to comment.