Removing duplicate dashboards
Summary
This KB documents an issue with Harvest dashboards being duplicated in Grafana. Trying to delete the dashboards leads to the error : "provisioned dashboard cannot be deleted".
Root cause
While there is no clear path to reproduce this bug, it seems to be related with Grafana being updated from a specific version to another. When this happens, dashboards exists twice in Grafana database, one with a random folder ID, and one with a correctly labeled ID, for example :
https://localhost/grafana/d/admrjje4ntt6oc/ontap3a-aggregate
https://localhost/grafana/d/cdot-aggregate/ontap3a-aggregate
Ideally, the dashboard with ID admrjje4ntt6oc has to be deleted but Grafana wouldn't accept the operation on a provisioned dashboard.
Resolution
Option 1 : Reset Grafana configuration
For now, the only easy way to clear duplicate dashboards is to totally reset Grafana database. While not ideal, it shouldn't be an issue for most users :
- No historical data will be lost
- Standard dashboards will automatically be re-provisioned
- LDAP configuration will automatically be restored
But any custom dashboards created by the users, or modifications of standard dashboards will be lost.
Open a SSH session to NAbox and run the following commands :
dc stop grafana
sudo mv /data/grafana/grafana.db /data/grafana/grafana.db.bak
dc start grafana
sudo rm -f /etc/nabox/secrets/grafana-secret
sudo systemctl restart naboxd
After a few seconds, Grafana will be available again with no duplicates.
Option 2 : Manually clean database
Another method is to clean the dashboard_provisioning table in Grafana
database, and remove just the duplicated entries.
This option requires that you copy grafana.db to a location with sqlite3
installed, then put the modified DB back in place.
sqlite3 grafana.db
delete from dashboard_provisioning;
^D
After restarting grafana, you should be able to remove the duplicated dashboards.
Please contact us for further guidance.
References
- Possibly related GitHub issue : https://github.com/grafana/grafana/issues/109229