rfmoz / grafana-dashboards

Grafana dashboards
Apache License 2.0
1.17k stars 445 forks source link

Changing datasource is not updating job #51

Closed smutel closed 10 months ago

smutel commented 4 years ago

Hello,

I have setup this dashboard with 2 prometheus datasources. When I switch from one datasource to another one, the jobs are not updated.

Thanks.

shmish111 commented 3 years ago

Same here

volserverRay commented 3 years ago

yes. same here. seems like changing the datasource is not working.

volserverRay commented 3 years ago

i have fixed the problem manually. not sure whether it's the correct way or not, but it's working well to change datasource.

basically I just find and replace all the lines of:

"datasource": "your-datasource-name",

to:

"datasource": "$DS_PROMETHEUS",

seems like your-datasource-name is set when you import the dashboard.

AdamDiouri commented 1 year ago

How can I do this in Grafana v8.5

hossein1376 commented 1 year ago

In Json editor press ctrl + H, then you need to replace all instances of this filed (that contains an uuid which will vary in yours):

"datasource": {
            "type": "prometheus",
            "uid": "fd1b579f-668g-4763-9c61-cbg6c6e605t7"
          },

with this:

"datasource": "$DS_PROMETHEUS",
Crumb5 commented 11 months ago

Also finding this. The datasource fix mentioned by @hossein1376 didn't work for me. Rev33 Grafana is version 10.1.5

EDIT: It does actually work. There were a bunch of uids of 00000001 or similar. I replaced them too and it started to work as expected.

This is surely a bug?

calestyo commented 11 months ago

I have the same problem. The reason seems to be that after importing, Grafana somehow rewrites the dashboard’s DS_PROMETHEUS variable to some fixed data source,... and it also shows the variable then to be unused (under Settings/Variables).

So possibly a bug in Grafana itself?

calestyo commented 11 months ago

I also found https://community.grafana.com/t/dashboard-import-with-datasource-variable/4896 but not sure whether this really solves anything.

calestyo commented 10 months ago

For me, this fixes the issue. At least it seems so. (Ignore 65e38a6... I had only fetched the current upstream master and forgot to merge it when I branched off).

I'm a bit unsure about these 00000001 UIDs that come up when one imported the old version (i.e. the one where ${DS_PROMETHEUS} is replaced with the datasource UID chosen in the import dialogue by Grafana).
Only some were 00000001 and other were some UUID.

I guess with my commit, all would be the UUID (from the datasource selected in the dashboard) or maybe even he real name of the datasource as string?!

Nevertheless, it seems to work.

rc5hack commented 7 months ago

Maybe related to https://github.com/grafana/grafana/issues/80666