Add logic to Grafana with promtheus data source

  • What Grafana version and what operating system are you using?
  • What are you trying to achieve?
    Show databases based on ENV selection, like select PROD and it will show the prod databases that are in a custom variable, using prometheus as data source.
  • How are you trying to achieve it?
    Using custom variables to write down the database names.
  • What happened?
    Can’t find a way or lack the experience to do what I need.
  • What did you expect to happen?
    Still trying to figure out if my approach is correct or is there a better approach.
  • Can you copy/paste the configuration(s) that you are having problems with?
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
  • Did you follow any online instructions? If so, what is the URL?

first, if you are new to Grafana, upgrade immediately. 7.5.2 is too old.

second, check out this dashboard:

also: Here are the docs on template variables. And here is a list of good examples on that use template variables. You can inspect each dashboard to see just how the variables are constructed.