On Friday, October 21, 2016 at 10:24:30 PM UTC+3, [email protected] wrote:
> i'm using telegraf and i can see that the n_cpus field is available under 
> systems. i also see that there is the load1 field.
> 
> what i would like to do is to plot the total total stacked loads of a 
> selection of hosts and have that overlaid with the total number of cores as a 
> threshold line. i'm essentially trying to replicate the ganglia cpu/load plot.
> 
> so far i have (in grafana):
> 
> SELECT mean("load1") FROM "system" WHERE "host" =~ /$hosts/ AND $timeFilter 
> GROUP BY time($interval), "host" fill(null)
> 
> and
> 
> SELECT sum("n_cpus") AS n_cpus FROM "system" WHERE "host" =~ /$hosts/ AND 
> $timeFilter GROUP BY time($interval) fill(null)
> 
> however, the latter does a sum of all values - given that telegraf runs every 
> 10s, it ends up overcounting the actual number of cpus in the system.
> 
> how can i get a meangingful count of the number of cpus in in $hosts?

Hi,

You will need a unique count of cpus per host per time interval to do a proper 
sum.

Because the query engine does not currently support nested functions, you would 
have to do it using a continuous query:

create continuous query cpucount on telegraf begin select max(n_cpus) as 
host_cpus into ncpu_10m from telegraf.autogen.system group by time(10m),host end
"
This will generate a measurement "ncpu_10m" that contains one "host_cpus" value 
per host per 10m interval.

Your Grafana dashboard can then do: select sum(host_cpus) from ncpu_10m where 
$timeFilter group by time(10m)

This will plot the total number of cpus across hosts.

-- 
Remember to include the version number!
--- 
You received this message because you are subscribed to the Google Groups 
"InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/influxdb/d4fdbfe6-7d0f-4cc4-8998-eeffe9438531%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to