Search code examples
prometheusgrafanapromqlprometheus-node-exporter

Grafana panel query only pick up one value when using query variables from Prometheus


I have defined a query variable like enter image description here

When using this variable to build a panel query enter image description here

I tried to investigate the problem via query inspector, then I found that the query only pick up one value from the variable with the query string of "sum(kube_pod_container_resource_limits_cpu_cores{node=~"de1tst-78j9w-infra-46r7f"})" enter image description here

And because the host that the query picks up coincidentally doesn't contain the metric, so it shows "N/A".

I want the panel query collects all nodes metrics that the variable returns, how could I let the panel query as expected by specifying "node=~${workers}"?


Solution

  • In Dashboard settings > Variables, set the following:

    Hide               = empty
    Multi-value        = enable
    Include All option = enable
    

    Use the "workers" picklist selector which will appear at the top of the dashboard to select the desired nodes or the "All" option.