Adding time_ prefix to all CPU time measurements

This commit is contained in:
Cameron Sparr 2015-09-21 10:05:58 -07:00
parent 82d914149e
commit b012713cf2
4 changed files with 34 additions and 22 deletions

View File

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

View File

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

View File

@ -47,16 +47,16 @@ Meta:
- tags: `cpu=<cpuN> or <cpu-total>`
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:

View File

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