Search code examples
drop-down-menudashboardgrafanagrafana-templating

Grafana dynamic dashboard


I am a newbie to grafana. I have made dashboards in grafana using MySQL query. For Example:

SELECT TimeOfDay as time,M00B01, M00B00,M00B02 from ABC where ABC_ID=0;

Now I want to give drop-down option on the dashboard that will allow the user to change the graph based on his selection checkbox he choose i.e. if he selects ‘M00B00’ then data points of ‘M00B00’ only should be fetched from the database against Time. If he select ‘M00B01’ then only ‘M00B01’ should be fetched from database. Or if he selected both option from drop-down he should be able to see the graph for both column.

How can i achieve this? I know I can use variables but what settings or configs to set to achieve this. Thank you. Any help is much appreciated.


Solution

  • Create a global variable with settings like the one in the screenshot, but with Client replaced with the label name that holds ‘M00B00’ and ‘M00B01’. Also, if you want the user to be able to select both together, make sure Multi-value checked. Global Variable Configuration

    Then, if you need help with the query configuration, this page should help: http://docs.grafana.org/features/datasources/mysql/