2

I am collecting data from a Proxmox host into an InfluxDB datasource. This datasource is used to power a Grafana dashboard. Data is collected as it should, but I have a problem plotting the CPU usage.

I have figured out that the data that is sent concerning the CPU is sent as jiffies, so I figured that;

System / System + User + Idle = Percentage System CPU Usage

I then have to take a mean of all those values to get the mean System CPU usage for the last minute. Here is where i run into a problem. The InfluxDB documentation states

The use of mathematical operators inside of function calls is currently unsupported.

as can be found here InfluxDB documentation

My question is if there is a workaround for this so I can calculate the mean of a sum.

Pieterjan
  • 445
  • 6
  • 23

1 Answers1

1

There is a way to do this with InfluxDB, but its a two step process.

  SELECT System / (System + User + Idle) AS avg
  INTO "sys_cpu" FROM "my_measurement"

Then simply issue a query

SELECT mean(value) FROM "sys_cpu" GROUP BY time(<interval>)

Its kind of messy, but should work.

Michael Desa
  • 4,607
  • 24
  • 19
  • I switched to graphite since that proved to be a better solution for me. I think this will work for people using InfluxDB though, so I'll mark this as the answer. – Pieterjan Sep 09 '16 at 13:44