Search code examples
centos7grafanagraphitehealth-monitoringcollectd

How to aggregate/Sum multiple CPU cores to get one CPU metric in grafana?


Is there a way to aggregate across metrics/metric-names? For example, on a four core system, you have the following metric-names:

cpu.0.system cpu.1.system cpu.2.system cpu.3.system

I would like to SUM(cpu.*.system) to get the aggregated cpu.system.total.

Is there a way to accomplish this with the current Grafana-graphite query-editor?

Please advise.


Solution

  • I got one other solution as described below:

    Edited vi /opt/collectd/etc/collectd.conf file.

    Uncomment LoadPlugin aggregation.

    LoadPlugin aggregation
    <Plugin aggregation>
      <Aggregation>
        #Host "unspecified"
        Plugin "cpu"
        #PluginInstance "unspecified"
        Type "cpu"
        #TypeInstance "unspecified"
    
        GroupBy "Host"
        GroupBy "TypeInstance"
    
    #    CalculateNum false
    #    CalculateSum false
        CalculateAverage true
    #    CalculateMinimum false
    #    CalculateMaximum false
    #    CalculateStddev false
      </Aggregation>
    </Plugin>
    

    And restarted the collecd services.