Difference between revisions of "Plugin:Aggregation/Config"

From collectd Wiki
Jump to: navigation, search
(Aggregated CPU statistics per host)
(Aggregated CPU statistics per host)
 
Line 2: Line 2:
  
 
== Aggregated CPU statistics per host ==
 
== Aggregated CPU statistics per host ==
 +
 +
The following configuration assumes your cpu plugin is configured this way:
 +
 +
<Plugin cpu>
 +
  ValuesPercentage false
 +
  ReportByCpu true
 +
</Plugin cpu>
  
 
The following configuration aggregates the CPU statistics of all CPUs into one set using the ''sum'' and ''average'' consolidation functions.
 
The following configuration aggregates the CPU statistics of all CPUs into one set using the ''sum'' and ''average'' consolidation functions.
It assumes your cpu plugin is configured using ''ValuesPercentage false'' and ''ReportByCpu true''.
 
  
 
  <Plugin "aggregation">
 
  <Plugin "aggregation">

Latest revision as of 15:39, 17 November 2017

This page contains some example configurations for the Aggregation plugin. This page is meant as a cookbook, so if you have a configuration for an aspect not handled here or a daemon not present, please feel free to add anything that's useful for you.

Aggregated CPU statistics per host

The following configuration assumes your cpu plugin is configured this way:

<Plugin cpu>
  ValuesPercentage false
  ReportByCpu true
</Plugin cpu>

The following configuration aggregates the CPU statistics of all CPUs into one set using the sum and average consolidation functions.

<Plugin "aggregation">
  <Aggregation>
    Plugin "cpu"
    Type "cpu"
    
    GroupBy "Host"
    GroupBy "TypeInstance"
    
    CalculateSum true
    CalculateAverage true
  </Aggregation>
</Plugin>

This will result in a per-CPU-state set of values for each host. The values will be names according to this schema:

host.example.com/aggregation-cpu-sum/cpu-idle
host.example.com/aggregation-cpu-sum/cpu-user
host.example.com/aggregation-cpu-sum/cpu-system
…
host.example.com/aggregation-cpu-average/cpu-idle
host.example.com/aggregation-cpu-average/cpu-user
host.example.com/aggregation-cpu-average/cpu-system
…

If you don't want to keep the per-CPU statistics around, you can use the filter mechanism to get rid of them:

LoadPlugin "match_regex" # we want to use this for our Matching
<Chain "PostCache">
  <Rule> # Send "cpu" values to the aggregation plugin.
    <Match regex>
      Plugin "^cpu$"
      PluginInstance "^[0-9]+$"
    </Match>
    <Target write>
      Plugin "aggregation"
    </Target>
    Target stop
  </Rule>
  <Target write> # Write everything else via "rrdtool".
    Plugin "rrdtool"
  </Target>
</Chain>

Aggregated CPU frequency per host

This example plots the average CPU frequency for a given host. It changes the GroupBy to "PluginInstance" to group all fields.

 <Plugin "aggregation">
   <Aggregation>
     Plugin "cpufreq"
     Type "cpufreq"
     GroupBy "Host"
     GroupBy "PluginInstance"
     CalculateAverage true
   </Aggregation>
 </Plugin>

See also