3

I have the challenge to feed some metrics to our central metric collection infrastructure, and one of those is the total CPU usage of the system. I'm using collectd to do so. By default, collectd spits out cpu-system, cpu-user and cpu-idle metrics (among others), but not the cpu-usage. From my point of view this would roughly be 100 - cpu-idle or cpu-system + cpu-user.

I'm already using the aggregation plugin so that I can aggregate the core metrics to a single metric. A metric looks as follows (just one example):

57501a6f-cdff-4d03-bd5b-ef67e1ad67d6.hostname_domain_tld.aggregation-cpu-average.cpu-idle 99.799081 1442245610

now I would like to either calculate 100 - cpu-idle or cpu-system + cpu-user and return that value as a new metric (cpu-usage).

I've tried to do so using this configuration:

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

  <Aggregation>
    Plugin "aggregation-cpu-average"
    Type "^/cpu-[system|user]$/"
    GroupBy "Host"
    SetPluginInstance "cpu-util"
    CalculateSum true
  </Aggregation>
</Plugin>

Unfortunately, this configuration doesn't seem to work, the Type parameter doesn't seem to be able to handle Regex expressions.

Does anybody have an idea how to achieve this? Thanks!

jritter
  • 61
  • 3

0 Answers0