Skip to content
Snippets Groups Projects
Commit 46a8bdbf authored by Adrián López's avatar Adrián López Committed by Daniel Nelson
Browse files

Add parameter to force the interval of gather for sysstat (#4068)

parent abdff033
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,9 @@ type Sysstat struct { ...@@ -33,6 +33,9 @@ type Sysstat struct {
// Sadc represents the path to the sadc collector utility. // Sadc represents the path to the sadc collector utility.
Sadc string `toml:"sadc_path"` 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 represents the path to the sadf cmd.
Sadf string `toml:"sadf_path"` Sadf string `toml:"sadf_path"`
...@@ -136,6 +139,11 @@ func (*Sysstat) SampleConfig() string { ...@@ -136,6 +139,11 @@ func (*Sysstat) SampleConfig() string {
} }
func (s *Sysstat) Gather(acc telegraf.Accumulator) error { 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 s.interval == 0 {
if firstTimestamp.IsZero() { if firstTimestamp.IsZero() {
firstTimestamp = time.Now() firstTimestamp = time.Now()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment