Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a $datasource variable in the Grafana dashboard. #349

Closed
ikogan opened this issue Dec 21, 2023 · 1 comment
Closed

Use a $datasource variable in the Grafana dashboard. #349

ikogan opened this issue Dec 21, 2023 · 1 comment

Comments

@ikogan
Copy link

ikogan commented Dec 21, 2023

Currently, each panel in the Grafana dashboard uses a hardcoded datasource uid of datasource. In our Grafana, we use Prometheus. This means that the dashboard doesn't work unless we manually modify each panel. If the dashboard used a variable instead and it didn't match our instance, we could simply pick from the dropdown.

The delivered Rancher dashboards use a template variable like this:

  "templating": {
    "list": [
      {
        "current": {
          "text": "Prometheus",
          "value": "Prometheus"
        },
        "hide": 0,
        "label": "Data Source",
        "name": "datasource",
        "options": [],
        "query": "prometheus",
        "refresh": 1,
        "regex": "",
        "type": "datasource"
      }
    ]
  }

Each panel then just references the $datasource variable.

@becitsthere
Copy link
Contributor

Thanks for raising the issue and making the improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants