2

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.

Parul Chourasia
  • 107
  • 1
  • 11

3 Answers3

2

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.

Parul Chourasia
  • 107
  • 1
  • 11
1

Try this

alias(sumSeries(cpu.*.system),'Total CPU')
Bilal Ali Jafri
  • 915
  • 1
  • 6
  • 17
1

Here's a solution using only build-in Grafana functions

1-sum(rate(node_cpu_seconds_total{mode="idle"}[20s]))/8

Grafana will calculate average CPU usage over last 20 seconds.

IMPORTANT
Change last number ("/8" in example above), to match number of cores on your monitored instance and "20s" to whatever time interval you wish.

then change graph's display unit to percent 0.0-1.0

Dharman
  • 30,962
  • 25
  • 85
  • 135
nuclear_party
  • 91
  • 1
  • 5