Templatizing Grafana Dashboard Json Automation

Hi
Have created a dashboard in grafana with many widgets and filters. Have exported the dashboard as json. All good till now :slight_smile:

Now I’m trying to templatize it. so I can reuse same json with different values through tiny automation script. E.g to change data source, hostname, path etc.

When I tried, it was failing report already exist and it will be overwritten, then I realized I need to change few id and remove uid but still unsuccessful.

My request is, could you kindly help me

  1. What attributes should I totally remove or make null value. So I can create new dashboard by importing updated json.

  2. Is there a better way to automate cloning dashboard and change few value so it can retrieve data from different datasource etc.

Sorry, I couldnt attach my json file for your quick reference.

Thanks in advance

  1. Remove the uid, the example as follow:
    "uid": "_60EMioWz",
    This is the result of the exported JSON, and if you need to import the JSON, remove the uid, so the dashboard will create new uid.
    Also, change the title:
    "title": "Netflow Exporter Overview", because if there same title, Grafana will show some warning
    Both of them is in the last line of JSON

  2. It’s little bit complex to be done.
    You need to provide the datasource first, then you must change the datasource fields accordingly.
    This should be relation on the dashboard level datasource and panel level datasource.

Regards,
Fadjar Tandabawana

Thanks a lot Fadjar, that worked perfectly :slight_smile: