Skip to content

Commit

Permalink
Add parameter to force the interval of gather for sysstat (#4068)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianlzt authored and danielnelson committed Apr 26, 2018
1 parent abdff03 commit 46a8bdb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plugins/inputs/sysstat/sysstat.go
Expand Up @@ -33,6 +33,9 @@ type Sysstat struct {
// Sadc represents the path to the sadc collector utility.
Sadc string `toml:"sadc_path"`

// Force the execution time of sadc
SadcInterval internal.Duration `toml:"sadc_interval"`

// Sadf represents the path to the sadf cmd.
Sadf string `toml:"sadf_path"`

Expand Down Expand Up @@ -136,6 +139,11 @@ func (*Sysstat) SampleConfig() string {
}

func (s *Sysstat) Gather(acc telegraf.Accumulator) error {
if s.SadcInterval.Duration != 0 {
// Collect interval is calculated as interval - parseInterval
s.interval = int(s.SadcInterval.Duration.Seconds()) + parseInterval
}

if s.interval == 0 {
if firstTimestamp.IsZero() {
firstTimestamp = time.Now()
Expand Down

0 comments on commit 46a8bdb

Please sign in to comment.