diff --git a/plugins/inputs/sysstat/sysstat.go b/plugins/inputs/sysstat/sysstat.go index 1daa85730..42ce89550 100644 --- a/plugins/inputs/sysstat/sysstat.go +++ b/plugins/inputs/sysstat/sysstat.go @@ -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"` @@ -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()