I'm using Grafana to show some data. I have 20 organisations and they all use the same dashboards (Dash1, Dash2, Dash3). Thus I can use the same json data for all dashboards in all organisations.
But I do not want to update it manually every time when I change something, thus I'm trying to create a python script which will do it for me.
I run the script as follows:
python update_dashboards.py Dash1
The python code is as follows:
try:
dashboard_name = sys.argv[1]
response = settings.get_request_with_token(settings.api_url + "search?query=" + dashboard_name)
dashboard = json.loads(response)
if len(dashboard) < 1:
print("There is no dashboard data.")
else:
dashboard_data = dashboard[0]
dashboard_uri = str(dashboard_data["uri"])
dashboard_data = dashboard_api.get_dashboard(dashboard_uri)
// Here I get dashboard details
except IndexError:
print("Please provide dashboard name!")
Thus I give the name of the dashboard that I want to copy to all organisations.
With my code I get successfully the dashboard that I want to copy.
My question is how can I now use this dashboard to copy it to all other organizations?