From 856655f9550011630799df1bf7770a3e96473dec Mon Sep 17 00:00:00 2001 From: Ildar Svetlov Date: Wed, 13 Dec 2017 23:13:56 +0400 Subject: [PATCH] Don't add system input uptime_format as a counter (#3578) --- plugins/inputs/system/SYSTEM_README.md | 3 ++- plugins/inputs/system/system.go | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/inputs/system/SYSTEM_README.md b/plugins/inputs/system/SYSTEM_README.md index 2ade1947b..09290832c 100644 --- a/plugins/inputs/system/SYSTEM_README.md +++ b/plugins/inputs/system/SYSTEM_README.md @@ -34,5 +34,6 @@ $ telegraf --config ~/ws/telegraf.conf --input-filter system --test * Plugin: system, Collection 1 * Plugin: inputs.system, Collection 1 > system,host=tyrion load1=3.72,load5=2.4,load15=2.1,n_users=3i,n_cpus=4i 1483964144000000000 -> system,host=tyrion uptime=1249632i,uptime_format="14 days, 11:07" 1483964144000000000 +> system,host=tyrion uptime=1249632i 1483964144000000000 +> system,host=tyrion uptime_format="14 days, 11:07" 1483964144000000000 ``` diff --git a/plugins/inputs/system/system.go b/plugins/inputs/system/system.go index 32c391f78..980e2fa38 100644 --- a/plugins/inputs/system/system.go +++ b/plugins/inputs/system/system.go @@ -46,7 +46,9 @@ func (_ *SystemStats) Gather(acc telegraf.Accumulator) error { "n_cpus": runtime.NumCPU(), }, nil) acc.AddCounter("system", map[string]interface{}{ - "uptime": hostinfo.Uptime, + "uptime": hostinfo.Uptime, + }, nil) + acc.AddFields("system", map[string]interface{}{ "uptime_format": format_uptime(hostinfo.Uptime), }, nil)