From 9ea7cdd319c5edeb4bcf907d33129c26b00cb123 Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Wed, 10 Apr 2019 17:19:29 -0700 Subject: [PATCH] Deprecate uptime_format field in system input (#5708) --- plugins/inputs/system/README.md | 2 +- plugins/inputs/system/system.go | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/inputs/system/README.md b/plugins/inputs/system/README.md index bea9bd2d9..efaa8a17f 100644 --- a/plugins/inputs/system/README.md +++ b/plugins/inputs/system/README.md @@ -25,7 +25,7 @@ the `telegraf` user to be added to the `utmp` group on some systems. - n_users (integer) - n_cpus (integer) - uptime (integer, seconds) - - uptime_format (string) + - uptime_format (string, deprecated in 1.10, use `uptime` field) ### Example Output: diff --git a/plugins/inputs/system/system.go b/plugins/inputs/system/system.go index 55ebbc59e..5c68870bb 100644 --- a/plugins/inputs/system/system.go +++ b/plugins/inputs/system/system.go @@ -9,11 +9,10 @@ import ( "strings" "time" - "github.com/shirou/gopsutil/host" - "github.com/shirou/gopsutil/load" - "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/plugins/inputs" + "github.com/shirou/gopsutil/host" + "github.com/shirou/gopsutil/load" ) type SystemStats struct{} @@ -22,7 +21,12 @@ func (_ *SystemStats) Description() string { return "Read metrics about system load & uptime" } -func (_ *SystemStats) SampleConfig() string { return "" } +func (_ *SystemStats) SampleConfig() string { + return ` + ## Uncomment to remove deprecated metrics. + # fielddrop = ["uptime_format"] +` +} func (_ *SystemStats) Gather(acc telegraf.Accumulator) error { loadavg, err := load.Avg()