Fix CPU system plugin gets stuck after system suspend (#3342)

This commit is contained in:
Pierre Fersing
2017-10-16 23:25:00 +02:00
committed by Daniel Nelson
parent 4b05edea53
commit f5a9d1bc75
3 changed files with 73 additions and 2 deletions

View File

@@ -96,7 +96,8 @@ func (s *CPUStats) Gather(acc telegraf.Accumulator) error {
totalDelta := total - lastTotal
if totalDelta < 0 {
return fmt.Errorf("Error: current total CPU time is less than previous total CPU time")
err = fmt.Errorf("Error: current total CPU time is less than previous total CPU time")
break
}
if totalDelta == 0 {
@@ -126,7 +127,7 @@ func (s *CPUStats) Gather(acc telegraf.Accumulator) error {
s.lastStats[cts.CPU] = cts
}
return nil
return err
}
func totalCpuTime(t cpu.TimesStat) float64 {