Skip to content

Commit e2fe3c5

Browse files
adrianlztarkady-emelyanov
authored andcommitted
Add parameter to force the interval of gather for sysstat (influxdata#4068)
1 parent 76a67b4 commit e2fe3c5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

plugins/inputs/sysstat/sysstat.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ type Sysstat struct {
3333
// Sadc represents the path to the sadc collector utility.
3434
Sadc string `toml:"sadc_path"`
3535

36+
// Force the execution time of sadc
37+
SadcInterval internal.Duration `toml:"sadc_interval"`
38+
3639
// Sadf represents the path to the sadf cmd.
3740
Sadf string `toml:"sadf_path"`
3841

@@ -136,6 +139,11 @@ func (*Sysstat) SampleConfig() string {
136139
}
137140

138141
func (s *Sysstat) Gather(acc telegraf.Accumulator) error {
142+
if s.SadcInterval.Duration != 0 {
143+
// Collect interval is calculated as interval - parseInterval
144+
s.interval = int(s.SadcInterval.Duration.Seconds()) + parseInterval
145+
}
146+
139147
if s.interval == 0 {
140148
if firstTimestamp.IsZero() {
141149
firstTimestamp = time.Now()

0 commit comments

Comments
 (0)