Hi Team,
In prometheus lab ( Lab – Operators, Vector Matching, Aggregators question no 8) - Construct a query that will show the number of CPUs on each instance across all jobs.
The solution given is - count by (instance) (node_cpu_seconds_total{mode=“idle”}).
Why is it neccessary to provide {mode=“idle”} parameter? In solution they have asked to select some arbitrary mode like idle
.
Can anyone explain…
Thanks!!
The explanation is given in the solution for Q7
With the node_cpu_seconds_total
metric match one of the modes, doesn’t matter which one. This will show a time series for each cpu for that mode.
All CPUs will export metrics for all modes. Run the query as-is in prometheus - you will get 36
If you take away the mode label, you will get 288
288 / 36 = 8, so there are 8 modes that are being monitored. Selecting any of the available modes should return the answer to 36