Add parameter to force the interval of gather for sysstat (#4068)
This commit is contained in:
parent
65f1a3a0e3
commit
aceba08d0f
|
@ -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 {
|
||||||
}
|
}
|
||||||
|
|
||||||
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()
|
||||||
|
|
Loading…
Reference in New Issue