2

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)

enter image description here

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:

enter image description here

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?

1
  • Load value can be more than number of CPUs. Especially if you have modern fast CPU and old slow storage. Really, there is no upper limit for that value. Also is load normalization by using number of CPUs is not correct. It should be number of online CPUs. Commented May 15, 2018 at 11:33

1 Answer 1

1

You should write a query similar to the following

SHOW TAG VALUES ON "DATABASE_NAME" FROM "elasticsearch_cluster_health" WITH KEY = "name"

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.