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:
Cameron Sparr 2016-02-19 11:56:33 -07:00
parent 3179829fa5
commit f9b5767dae
2 changed files with 10 additions and 1 deletions

View File

@ -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{},
}
})
}

View File

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