Divide Windows Process % Processor Time by the Number of Processors (say that 10 times fast)

Hello All,

I am struggling to find a solution for what I suspect must be a common issue. I am measuring the amount of processor time specific Windows processes are using. I am getting the Windows process utilization from Telegraf. In order to “normalize” the data so that it matches the physical CPU % processor utilization I need to divide it by the number of logical CPUs in the system.

For example: in a quad core system, 60% of reported Windows process utilization equals 15% of physical processor time (60% divided by 4 = 15%).

Because I test lots of systems with different processor counts, it would be great to have the graphs perform this math by dynamically adjusting the divisor to the number of CPUs for each monitored machine.

It works fine if I create a static math expression as part of the query [math ( /4) for example]; but the challenge is dynamically replacing the ‘4’ with the number of CPUs.

I can get the number of CPUs from Telegraf as a tag, but I am lost trying to then use that tag in a math expression; or convert it to a variable or whatever needs to be done to dynamically divide the process utilization by the number of CPUs.

Do I need to do this in the InfluxDB somehow?

Thanks in advance for the help. Grafana is amazing! I am finally converting from nearly 20 years using Cacti…

InfluxDB with the sql syntax does not have full subquery support (like Graphite and Prometheus do). But your calculation should be possible if the fields (or aggregations) are in the same measurement.

Have you seen this docs page for InfluxDB - it has a bunch of examples: https://docs.influxdata.com/influxdb/v1.7/guides/calculating_percentages/

You might have to switch to raw mode in Grafana to be able to some of the more advanced stuff.

If that doesn’t work, could you show your query and maybe we can figure out something. Another alternative would be use to use the new Flux language for InfluxDB which does have subquery support.