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
3179829fa5
commit
f9b5767dae
|
@ -113,6 +113,10 @@ func totalCpuTime(t cpu.CPUTimesStat) float64 {
|
|||
|
||||
func init() {
|
||||
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 {
|
||||
writers := []io.Writer{}
|
||||
|
||||
if len(f.Files) == 0 {
|
||||
f.Files = []string{"stdout"}
|
||||
}
|
||||
|
||||
for _, file := range f.Files {
|
||||
if file == "stdout" {
|
||||
writers = append(writers, os.Stdout)
|
||||
|
|
Loading…
Reference in New Issue