Sharing dashboards - Path of least resistance

Hi,

I created a dashboard with a bunch of panels and visuals, and I now need to share this with customers.

My dashboard requires 2 distinct data sources. Both connect to the same SQL Server instance, but different databases. Call them OpsDB and OpsDW (Operations Database and Operations Data warehouse). This is how I’ve named my data sources, to distinguish which one talks to which database.

Because I have a lot of panels that share the same query, I’ve defined a row (“Queries”) that defines many table panels - each one performing a different query, and each one of those specifies one of the two data sources (OpsDB or OpsDW). Then I collapse the “Queries” row, and define panels in other rows (that are kept expanded) to use one of those panels from the hidden “Queries” row as their data source.

I’m on Grafana 11.1.0; I’ve used Share, Export, and Save to File (making sure I enable the “Export for sharing externally” option). I can see, at the top of the JSON file created, that it defines two entries under “__inputs” (each with a different “name” property, one for each DB referenced), and the rest of my file defines multiple “datasource”, where each “uid” refers to one of the two names defined under “__inputs” - such as:

“uid”: “${name1}”
or
“uid”: “${name2}”

This makes sense to me. So, at this point, I was expecting to be able to instruct my users to create two SQL Server data sources, each set up to point to one of the two databases. After doing this, if I import the JSON file in a new Grafana instance, I’d expect to have to somehow/somewhere tweak the two data sources I need (map them to the data sources I’ve manually defined on the new Grafana instance). But that’s not quite what’s going on.

What’s happening after importing is that the dashboard shows each panel, with the visuals (because they’re using a still-unknown data source) all showing “No data”, with the tooltip showing “Datasource [xyz] was not found”. Makes sense, since the details of the data sources (name of SQL Server and DBs) are NOT part of the JSON exported.

As mentioned, my dashboard currently defines one “Queries” row, that I keep collapsed, and this row has a total of 7 visuals - 7 tables, each doing a different query. Right now, I have to revisit each one of those 7 tables that define a query, and select Edit; when I do that, I can see the Data source has automatically been set to the SQL Server data source that the user (who imported my dashboard) had defined previously, but it’s not getting any data back. If I click on Run Query, there’s no change. However, if I make a change to the query - any change, it could be something as simple adding a blank line to it, and then hit Run Query, then I get results and can hit the Apply button–and suddenly, every other row that has a panel that refers to that table shows data. Then I have to revisit every other panel in my “Queries” row and make a change in the same way.

Having to revisit each one of my 7 query-defining panels is tedious enough - and it’s only going to get worse as I introduce more. I would’ve expected to be able to define my two data sources (one for each database) once, and be done with it, rather than having to visit each query. Asking my users to revisit each “source panel” isn’t going to fly.

I thought at first this might have to do with the fact that, on Grafana instance A, my data sources were using different names than they do on Grafana instance B, but even if I recreate brand new data sources on instance B and give them the exact same names as they exist on instance A, I still have to revisit every query.

Is this expected, or can this be made to work with less effort?

[Edit]

After re-exporting my file to disk, the Import step SOMEHOW is now prompting me, under the Options section, to fill in my OpsDB and OpbDW data sources. THIS WAS NOT SHOWING UP BEFORE. I’ve probably “exported it wrong” before, so my question is now - how do I ensure this gets triggered?

Replying to myself.

This is no longer a concern. As long as the “Export for sharing externally” checkbox is checked when I export the dashboard to a JSON file, the __inputs entries are there, and I always get prompted (at import time) to map the data sources to my actual databases.

Now that this is clear to me, I’m not quite sure what problem it is I was encountering, since it seems to be working consistently. Maybe as some point I forgot to use the checkbox.

If an admin wants to delete this thread, go right ahead…