Provide default args: percpu=true and totalcpu=true for cpu plugin
Also if outputs.file is empty, write to stdout closes #720
This commit is contained in:
parent
7d8e883307
commit
659357c1d0
|
@ -113,6 +113,10 @@ func totalCpuTime(t cpu.CPUTimesStat) float64 {
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
inputs.Add("cpu", func() telegraf.Input {
|
inputs.Add("cpu", func() telegraf.Input {
|
||||||
return &CPUStats{ps: &systemPS{}}
|
return &CPUStats{
|
||||||
|
PerCPU: true,
|
||||||
|
TotalCPU: true,
|
||||||
|
ps: &systemPS{},
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,11 @@ func (f *File) SetSerializer(serializer serializers.Serializer) {
|
||||||
|
|
||||||
func (f *File) Connect() error {
|
func (f *File) Connect() error {
|
||||||
writers := []io.Writer{}
|
writers := []io.Writer{}
|
||||||
|
|
||||||
|
if len(f.Files) == 0 {
|
||||||
|
f.Files = []string{"stdout"}
|
||||||
|
}
|
||||||
|
|
||||||
for _, file := range f.Files {
|
for _, file := range f.Files {
|
||||||
if file == "stdout" {
|
if file == "stdout" {
|
||||||
writers = append(writers, os.Stdout)
|
writers = append(writers, os.Stdout)
|
||||||
|
|
Loading…
Reference in New Issue