diff --git a/CHANGELOG.md b/CHANGELOG.md index dc566bb9e..7f2a3440f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,9 +3,13 @@ ### Release Notes - InfluxDB output config change: `url` is now `urls`, and is a list. Config files will still be backwards compatible if only `url` is specified. +- The -test flag will now output two metric collections - **Breaking Change**: The CPU collection plugin has been refactored to fix some bugs and outdated dependency issues. At the same time, I also decided to fix -a naming consistency issue, so cpu_percentageIdle will become cpu_usage_idle +a naming consistency issue, so cpu_percentageIdle will become cpu_usage_idle. +Also, all CPU time measurements now have it indicated in their name, so cp_idle +will become cpu_time_idle, additionally, these cpu_time measurements are going +to be dropped in the default config with a plugin drop parameter. ### Features - [#143](https://github.com/influxdb/telegraf/issues/143): InfluxDB clustering support diff --git a/agent.go b/agent.go index e74622457..a8ee44207 100644 --- a/agent.go +++ b/agent.go @@ -363,7 +363,7 @@ func (a *Agent) Test() error { acc.Prefix = plugin.name + "_" acc.Config = plugin.config - fmt.Printf("* Plugin: %s\n", plugin.name) + fmt.Printf("* Plugin: %s Collection 1\n", plugin.name) if plugin.config.Interval != 0 { fmt.Printf("* Internal: %s\n", plugin.config.Interval) } @@ -371,6 +371,12 @@ func (a *Agent) Test() error { if err := plugin.plugin.Gather(&acc); err != nil { return err } + + time.Sleep(500 * time.Millisecond) + fmt.Printf("* Plugin: %s Collection 2\n", plugin.name) + if err := plugin.plugin.Gather(&acc); err != nil { + return err + } } return nil diff --git a/plugins/system/CPU_README.md b/plugins/system/CPU_README.md index fe547c564..85436e60d 100644 --- a/plugins/system/CPU_README.md +++ b/plugins/system/CPU_README.md @@ -47,16 +47,16 @@ Meta: - tags: `cpu= or ` Measurement names: -- cpu_user -- cpu_system -- cpu_idle -- cpu_nice -- cpu_iowait -- cpu_irq -- cpu_softirq -- cpu_steal -- cpu_guest -- cpu_guest_nice +- cpu_time_user +- cpu_time_system +- cpu_time_idle +- cpu_time_nice +- cpu_time_iowait +- cpu_time_irq +- cpu_time_softirq +- cpu_time_steal +- cpu_time_guest +- cpu_time_guest_nice ### CPU Usage Percent Measurements: diff --git a/plugins/system/cpu.go b/plugins/system/cpu.go index d0b80bcc8..7595b693a 100644 --- a/plugins/system/cpu.go +++ b/plugins/system/cpu.go @@ -30,6 +30,8 @@ var sampleConfig = ` percpu = true # Whether to report total system cpu stats or not totalcpu = true + # Comment this line if you want the raw CPU time metrics + drop = ["cpu_time"] ` func (_ *CPUStats) SampleConfig() string { @@ -50,16 +52,16 @@ func (s *CPUStats) Gather(acc plugins.Accumulator) error { total := totalCpuTime(cts) // Add total cpu numbers - add(acc, "user", cts.User, tags) - add(acc, "system", cts.System, tags) - add(acc, "idle", cts.Idle, tags) - add(acc, "nice", cts.Nice, tags) - add(acc, "iowait", cts.Iowait, tags) - add(acc, "irq", cts.Irq, tags) - add(acc, "softirq", cts.Softirq, tags) - add(acc, "steal", cts.Steal, tags) - add(acc, "guest", cts.Guest, tags) - add(acc, "guest_nice", cts.GuestNice, tags) + add(acc, "time_user", cts.User, tags) + add(acc, "time_system", cts.System, tags) + add(acc, "time_idle", cts.Idle, tags) + add(acc, "time_nice", cts.Nice, tags) + add(acc, "time_iowait", cts.Iowait, tags) + add(acc, "time_irq", cts.Irq, tags) + add(acc, "time_softirq", cts.Softirq, tags) + add(acc, "time_steal", cts.Steal, tags) + add(acc, "time_guest", cts.Guest, tags) + add(acc, "time_guest_nice", cts.GuestNice, tags) // Add in percentage if len(s.lastStats) == 0 {