Skip to content

Backup/restore not working as expected #21

@dictvm

Description

@dictvm

I 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions