hagen1778 / grafana-import-export

shell scripts for importing and exporting Grafana's dashboards and datasources
160 stars 62 forks source link

Update export script to allow create dashboard #12

Open vinilima07 opened 4 years ago

vinilima07 commented 4 years ago

To create a new Dashboard with import script, the API needs to see id=null and uid=null and/or overwrite = true on Dashboard config. To do that, i try change the label values with JQ.

hagen1778 commented 4 years ago

Hi @viniciusfdev ! The docs say:

dashboard.id – id = null to create a new dashboard.
dashboard.uid – Optional unique identifier when creating a dashboard. uid = null will generate a new uid.

I guess it is not that straightforward. If those params are nullified and user tries to restores dashboards after some unexpected modification - he will get a bunch of new dashboards instead of restored old ones. The uid param is even more important because it allows to have consistent links to dashboard. It may be a surprise to get all links broken after dashboards restore.

I'd suggest to have a separate option/flag on import procedure to nullify this params if needed.