Search code examples
grafanagrafana-templatinggrafana-api

How to add a dropdown menu in Grafana?


I need a way to add a Dropdown menu ( or similar solution ) to show the metrics for only one cpu ( cpu 1 or cpu 0 ). Is this possible? The metric is node_cpu_seconds_total

enter image description here


Solution

    1. Create a custom variable named "cpu" with values 0 and 1 in Dashboard settings > Variables > New

    enter image description here

    1. Create the graph panel using the cpu variable (use the ":pipe" suffix to enable the use of 0 and 1 options at the same time)

    enter image description here

    1. The CPU can be selected in the dropdown menu

    enter image description here