Backup/restore not working as expected
See original GitHub issueI have attempted to restore a backup of all dashboards of a Grafana installation using sqlite3 for its storage. Now I want to migrate to Postgres due to database locking issues. My plan was to fire up a new instance of Grafana, configure it to use Postgres and then restore the dashboards from the backup to the new instance. To make things easier I decided to just use the http api.
I’m using a grafcli.ini
in the same directory where I’m executing grafcli and where the backup is stored. The crendentials are provided in the grafcli.ini
-file.
However, grafcli complains about getting a 404 from the new Grafana instance:
grafcli restore backup.tgz remote/newinstance
Traceback (most recent call last):
File "/usr/local/bin/grafcli", line 27, in <module>
sys.exit(main())
File "/usr/local/bin/grafcli", line 13, in main
result = cli.execute(*sys.argv[1:])
File "/usr/local/lib/python3.6/site-packages/climb/core.py", line 79, in execute
return self._commands.execute(command, **kwargs)
File "/usr/local/lib/python3.6/site-packages/climb/commands.py", line 26, in execute
return method(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/grafcli/commands.py", line 205, in restore
self.file_import(file_path, doc_path)
File "/usr/local/lib/python3.6/site-packages/grafcli/commands.py", line 237, in file_import
self._resources.save(path, document)
File "/usr/local/lib/python3.6/site-packages/grafcli/resources/resources.py", line 51, in save
return manager.save(document, *parts)
File "/usr/local/lib/python3.6/site-packages/grafcli/resources/common.py", line 46, in save
origin_document = self.get(dashboard_name, row_name, panel_name)
File "/usr/local/lib/python3.6/site-packages/grafcli/resources/common.py", line 33, in get
dashboard = self._storage.get(dashboard_name)
File "/usr/local/lib/python3.6/site-packages/grafcli/storage/api.py", line 37, inget
source = self._call('GET', 'dashboards/db/{}'.format(dashboard_id))
File "/usr/local/lib/python3.6/site-packages/grafcli/storage/api.py", line 29, in_call
response.raise_for_status()
File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 937, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://newinstance.corp.tld/api/dashboards/db/dashboard_to_restore
Am I missing something or is this a bug? Let me know if you need me to provide additional information.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Volume backup/restore on docker not working as expected
I solved the problem by modifying the commands to the following: Backup: docker run --rm --volumes-from container1 -v $(pwd):/backup ubuntu ...
Read more >Troubleshooting Tableau Server Backups and Restores
Question. How to troubleshoot the most common causes of issues with Tableau Server backups and restores.
Read more >Tableau Server Backup Restore ProviderNotFoundException ...
This job failed due to unexpected error: 'ProviderNotFoundException' ... new backup file into the default location, backup restore went smooth as expected.
Read more >Theme styles broken and a full backup restore doesn't work?
“The loopback request to your site failed, this means features relying on them are not currently working as expected.”.
Read more >Fix native backup and restore issues in RDS for SQL Server
This error occurs if you have space-related issues on the DB instance when restoring the backup from Amazon Elastic Compute Cloud (Amazon ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, right. This might be not so trivial then. It’s connected to #8.
When grafcli was first created, grafana didn’t have any export mechanism or API support yet, so all operations were based on direct SQL manipulation. That’s why there are some differences now when working with the current API. I will definitely look into this soon.
Once again, if you’re in a hurry, you could try creating manually the data source with the same name. I’m not sure about the alert-related error though.
My local tests succeeded, but in production I could not fully restore from the backup. After restoring 5 dashboards I’m hitting a 500:
I checked the Grafana pod’s logs and it seems it’s missing the data sources and that something’s off with the alert of one of our dashboards:
According to the Grafana docs, exporting a dashboard should also include the data sources it depends on. Doesn’t grafcli behave the same?
Thanks!