Don't add system input uptime_format as a counter (#3578)

(cherry picked from commit d935dfa9ed)
This commit is contained in:
Ildar Svetlov 2017-12-13 23:13:56 +04:00 committed by Daniel Nelson
parent 648d3bde33
commit c322ddb4b0
No known key found for this signature in database
GPG Key ID: CAAD59C9444F6155
2 changed files with 5 additions and 2 deletions

View File

@ -34,5 +34,6 @@ $ telegraf --config ~/ws/telegraf.conf --input-filter system --test
* Plugin: system, Collection 1 * Plugin: system, Collection 1
* Plugin: inputs.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 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
``` ```

View File

@ -47,6 +47,8 @@ func (_ *SystemStats) Gather(acc telegraf.Accumulator) error {
}, nil) }, nil)
acc.AddCounter("system", map[string]interface{}{ 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), "uptime_format": format_uptime(hostinfo.Uptime),
}, nil) }, nil)