From ec47cab950cb733cb56b10ba50313f0d167fff01 Mon Sep 17 00:00:00 2001
From: Vincent Caron <vincent@zerodeux.net>
Date: Fri, 27 Apr 2018 23:55:10 +0200
Subject: [PATCH] Use same timestamp for fields in system input (#4078)

---
 plugins/inputs/system/system.go | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/plugins/inputs/system/system.go b/plugins/inputs/system/system.go
index fd204d6a..ad17c56e 100644
--- a/plugins/inputs/system/system.go
+++ b/plugins/inputs/system/system.go
@@ -7,6 +7,7 @@ import (
 	"os"
 	"runtime"
 	"strings"
+	"time"
 
 	"github.com/shirou/gopsutil/host"
 	"github.com/shirou/gopsutil/load"
@@ -43,7 +44,8 @@ func (_ *SystemStats) Gather(acc telegraf.Accumulator) error {
 		return err
 	}
 
-	acc.AddGauge("system", fields, nil)
+	now := time.Now()
+	acc.AddGauge("system", fields, nil, now)
 
 	hostinfo, err := host.Info()
 	if err != nil {
@@ -52,10 +54,10 @@ func (_ *SystemStats) Gather(acc telegraf.Accumulator) error {
 
 	acc.AddCounter("system", map[string]interface{}{
 		"uptime": hostinfo.Uptime,
-	}, nil)
+	}, nil, now)
 	acc.AddFields("system", map[string]interface{}{
 		"uptime_format": format_uptime(hostinfo.Uptime),
-	}, nil)
+	}, nil, now)
 
 	return nil
 }
-- 
GitLab