Does mean() do what I guess it does?

Hi all,

This configuration:

Machine has got 16 cores and the resources are named cputemp-0 to cputemp-15, respectively. Does the mean() function here really calculate the mean value of all 16 cores or is this the mean over 15 seconds of the first value, in that case cpu-0?
How would I get the proper mean of all cores in the latter case?

The math expression takes care of the fact that the temperature is reported in deciKelvin.

Thanks!
Patrick

Since your query doesn’t group by the resource, when aggregating the core name is disregarded and you get the mean of all measurements from all the cores for the duration.

If you want to get the average per core for the period you’ll have to add the tag(resource) group by statement.

Great, I want the mean over all cores. Thanks.

1 Like

After I added a graph displaying the temperature over time and noticing some inconsistency I am still not entirely convinced this is what I want :wink:
It looks like i get the mean over all CPU cores (good), but also over all measurements retrieved by $timeFilter. Is this correct? Because when I look at the raw data the values displayed in Grafana seem to be a moving average over $timeFilter.
How can I get the mean/average over a single value for all cores and then display this over time? The last value to the right of the graph should always be the current average of the temperature of all cores.

To illustrate this is the query as defined at the moment:

As code:

SELECT mean("value") / 10 - 273.15 FROM "temperature" WHERE ("resource" = 'cputemp' AND "hostname" =~ /^$host/) AND $timeFilter GROUP BY time($interval)

The series in influx are are set up like this:

temperature,hostname=freenas-pmh_local,instance=0,resource=cputemp
temperature,hostname=freenas-pmh_local,instance=1,resource=cputemp
temperature,hostname=freenas-pmh_local,instance=10,resource=cputemp
temperature,hostname=freenas-pmh_local,instance=11,resource=cputemp
temperature,hostname=freenas-pmh_local,instance=12,resource=cputemp
temperature,hostname=freenas-pmh_local,instance=13,resource=cputemp
temperature,hostname=freenas-pmh_local,instance=14,resource=cputemp
temperature,hostname=freenas-pmh_local,instance=15,resource=cputemp
temperature,hostname=freenas-pmh_local,instance=2,resource=cputemp
temperature,hostname=freenas-pmh_local,instance=3,resource=cputemp
temperature,hostname=freenas-pmh_local,instance=4,resource=cputemp
temperature,hostname=freenas-pmh_local,instance=5,resource=cputemp
temperature,hostname=freenas-pmh_local,instance=6,resource=cputemp
temperature,hostname=freenas-pmh_local,instance=7,resource=cputemp
temperature,hostname=freenas-pmh_local,instance=8,resource=cputemp
temperature,hostname=freenas-pmh_local,instance=9,resource=cputemp

So what I try to get is the mean over the 16 measurements at a single point of time. And then a graph over time from that.

Thanks,
Patrick

By using the Bar Gauge instead of the Gauge plugin I managed to at least get the current (last recorded) value for each individual core. Now, how can i calculate the average of these?

And, yes, how can I fix the bogus sorting?

And, no, they are not always equal - that was an accident when I took the screen shot. They differ by up to at least a degree, that’s why I want the average as “the” CPU temperature. Displaying 16 cores individually just doesn’t make sense.

Hmmm … I could possibly calculate the mean() and use a “LIMIT(16)”, but then as you can see in the screen shot I monitor multiple servers and of course they have varying numbers of cores …

I found that the Blendstat plugin can do what I want to achieve for a single gauge display (current temperature average across all cores).
For a time series graph I will probably have to live with simply using a group by tag(instance) clause to draw an indivdual line for each core.