Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore is not done #213

Open
nicosistemas opened this issue May 10, 2023 · 2 comments
Open

Restore is not done #213

nicosistemas opened this issue May 10, 2023 · 2 comments

Comments

@nicosistemas
Copy link

Hello, I have a problem when restoring the backup hosted in S3. As you can see, the backup is done and uploaded correctly to S3, but when I try the restore it throws me the following error.
I also had it run as Cronjobs in Kubernetes and it does the backup successfully but not the restore.
Can someone give me a little help?

Docker:

sudo docker run --user $(id -u):$(id -g) --rm --name grafana-backup-tool
-e GRAFANA_TOKEN="glsa_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
-e GRAFANA_URL=https://sre-monitor-dev.gruposancristobal.org.ar
-e GRAFANA_ADMIN_ACCOUNT=admin
-e GRAFANA_ADMIN_PASSWORD=xxxxxxxxxxxxxxxxxxxxxxx
-e VERIFY_SSL=False
-v /tmp/backup/:/opt/grafana-backup-tool/OUTPUT
-e AWS_S3_BUCKET_NAME="sre-backup-grafana"
-e AWS_S3_BUCKET_KEY="backup"
-e AWS_DEFAULT_REGION="us-east-1"
-e AWS_ACCESS_KEY_ID="xxxxxxxxxxxxxxxxxxxxxxx"
-e AWS_SECRET_ACCESS_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
-e RESTORE="true"
-e ARCHIVE_FILE="202305101820.tar.gz"
ysde/docker-grafana-backup-tool

Error:

########################################

[Pre-Check] Server status is 'OK' !!

########################################

Download archives from S3:
Download from S3 was successful
restoring datasource: /tmp/tmpbn3zjt2e/OUTPUT/datasources/202305101820/rjriIiKVk.datasource
[DEBUG] resp status: 409
[DEBUG] resp body: {'message': 'data source with the same name already exists', 'traceID': ''}
create datasource: Prometheus, status: 409, msg: {'message': 'data source with the same name already exists', 'traceID': ''}
restoring library_element: /tmp/tmpbn3zjt2e/OUTPUT/library-elements/202305101820/xMDOgqA4k.library_element
[DEBUG] resp status: 200
[DEBUG] resp body: []
query folder:, status:200
Traceback (most recent call last):
File "/usr/bin/grafana-backup", line 33, in
sys.exit(load_entry_point('grafana-backup==1.3.0', 'console_scripts', 'grafana-backup')())
File "/usr/lib/python3.10/site-packages/grafana_backup/cli.py", line 55, in main
restore(args, settings)
File "/usr/lib/python3.10/site-packages/grafana_backup/restore.py", line 98, in main
restore_components(args, settings, restore_functions, tmpdir)
File "/usr/lib/python3.10/site-packages/grafana_backup/restore.py", line 136, in restore_components
restore_functions[ext](args, settings, file_path)
File "/usr/lib/python3.10/site-packages/grafana_backup/create_library_element.py", line 23, in main
library_element["folderUid"] = folder_id_response[0]['uid']
IndexError: list index out of range

@nicosistemas
Copy link
Author

I only need to restore dashboards. So I understand that it does restore everything, right?

Run these functions:
https://github.com/ysde/grafana-backup-tool/blob/4a85d57685689bd469d3a697dfcd707c0b920eca/grafana_backup/restore.py#LL83C5-L83C54

@ysde
Copy link
Owner

ysde commented Jun 2, 2023

Hi @nicosistemas yes, it aims to backup and restore everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants