Reputation: 26905
I am collecting metrics using telegraf and the system plugin on influxdb, I am trying to create some singlestats pannels to measure the load average on multiple instances with accurate "warnings"
For doing this I need to create a template variable with the number of existing CPUs based on the selected $host
in the gauge meter and coloring thresholds options:
SHOW TAG VALUES WITH KEY=host
The dashboard should return only information from the selected host, therefore, I need to dynamically configure the Gauge values max
and coloring thresholds so that the colors could change for example to red when the load is matching the number of cores - 1
.
Currently, I am hardcoding the values in max = 4
and in the Coloring threshold using 1,3
that is ncpus -1
. (this works only for instances having 4 cores, but not for instances having less or more than 4)
My try to create a variable named $ncpus
is this:
> SELECT last("n_cpus") FROM "system" WHERE ("host" =~ /^my-host$/)
name: system
time last
---- ----
1526379330000000000 4
I want to get the 4
but I am getting the time
, this is what I am using currently:
Any idea about how to get only the number of cpus n_cpus
so that could be stored in a variable removing the time
and also been available to use it in the singlestat
options?
Upvotes: 2
Views: 8425
Reputation: 390
You should write a query similar to the following
SHOW TAG VALUES ON "DATABASE_NAME" FROM "elasticsearch_cluster_health" WITH KEY = "name"
Upvotes: 1