6.03L Dynamic panels based on variables - MartinWong06/grafana GitHub Wiki

  1. Create a new dashboard, click on the gear button and got to variables tab. Click on add new variable

  2. Provide the following details

  • Name - variable name using in promql

  • label - This Label will show on the Dashboard, you have the option select Label and value, value or nothing

  • Description - Description of the variable

  • Query Options

  • Data sources - Select Prometheus

  • Query - Input the query that you would like to use in variable

    • Query Type - Label values
    • Label - name
    • Metrics - container_memory_usage_bytes
  • Regex - using regex further filter the variable result

  • Select Options

    • check on "Multi Value"
    • Check on "Include All Options"

Preview of values - Show query result values.

Example:
image image

  1. Add row on the dashboard

  2. Click on the row cluster button then configure as below example to use the variable
    image

  3. Add the panel under the first row, develop your panel with the variable.

  4. You may using following query PromQL

    container_memory_usage_bytes{job="cadvisor",name=~"$container.*"}
⚠️ **GitHub.com Fallback** ⚠️