Deprecate uptime_format field in system input (#5708)

This commit is contained in:
Daniel Nelson 2019-04-10 17:19:29 -07:00 committed by GitHub
parent 4079e4605f
commit 9ea7cdd319
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -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:

View File

@ -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()