Add n_cpu field to system plugin

closes #1041
This commit is contained in:
Cameron Sparr 2016-04-20 18:22:04 -06:00
parent f1b7ecb2a2
commit c0588926b8
1 changed files with 2 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"bufio" "bufio"
"bytes" "bytes"
"fmt" "fmt"
"runtime"
"github.com/shirou/gopsutil/host" "github.com/shirou/gopsutil/host"
"github.com/shirou/gopsutil/load" "github.com/shirou/gopsutil/load"
@ -43,6 +44,7 @@ func (_ *SystemStats) Gather(acc telegraf.Accumulator) error {
"uptime": hostinfo.Uptime, "uptime": hostinfo.Uptime,
"n_users": len(users), "n_users": len(users),
"uptime_format": format_uptime(hostinfo.Uptime), "uptime_format": format_uptime(hostinfo.Uptime),
"n_cpus": runtime.NumCPU(),
} }
acc.AddFields("system", fields, nil) acc.AddFields("system", fields, nil)