Is there any way that we can backup all the alert templates and alert rules?
Could someone please assist me?
Hi, @Naresh9999! Can you elaborate more on the problem you are trying to solve?
Backup them to move to another Instance or just to have additional backup?
The usual PMM data volume backup should have all rules and templates.
We would like to schedule daily backups for alerting and all other databases.
Can you please provide a PMM server daily backup feature so that we can schedule daily backup’s for PMM?
or are you looking for a Hot Backup option?
Sorry for the delay in response.
Thanks for the details, Roma. Yesterday, I found the below git developed by @steve.hoffman
This is a very simple script, and we can easily take the backups and restore them to a new server or on the same server.
I felt that if we could give a GUI feature for this script so that we could schedule daily backups to S3 or a custom location (PMM server backup directory, I mean outside of the PMM server container) from the PMM GUI, that would be good.
@steve.hoffman Thanks for the script.
I’m glad you like it! It was designed for exactly what you describe as a working prototype. I wanted something I could run as a cronjob to take regular backups (separate cron to remove old backups) without having to stop PMM. I tried to write it so that you could run it no matter the install type (Docker, OVA, AMI, K8s) but particularly for the OVA (virtual appliance) because it’s the hardest one to do a base OS upgrade to so this lets you do a backup, restore, flip.
If you want to submit any improvements just let me know…PR’s are always welcome!
Sure @steve.hoffman
I will definitely submit if any improvement’s are required.
@steve.hoffman We must include the SQLlite DB database in the backup script once we switch from SQLlite DB to PostgreSQL, which is the Grafana schema, I guess.
run_root “pg_dump -c -C -U pmm-managed > "${backup_dir}"/postgres/backup.sql” → We should include the Grafana schema in the pg_dump command.
Yes! I haven’t had a chance to play with a PMM using the new PG storage for grafana config but I assume it’ll be one more table to both backup, verify, and restore.
I understand @steve.hoffman
We can prepare for the script adjustments once the 2.40 version is out.
@steve.hoffman Could you please add new PostgreSQL (SQLite DB tables) table backup as part of the below backup script? As we have today, PMM 2.40 has been released, and we need to make sure the script is updated.
Could you please add new PostgreSQL (SQLite DB tables) table backup as part of the below backup script?
I’ll try to spend some time on it tomorrow. Just been swamped!
Sure, thanks for the update @steve.hoffman
Just an update…I’ve made the changes but haven’t committed yet as I’m investigating a problem with the clickhouse backups and restores on PMM >=2.39.0. a valid backup is taken but the change prevents it from being restored without manual intervention.
Thanks @steve.hoffman
I hope everything gets fixed.
well…I now know the problem…(got confirmation from devs and vendor over the weekend) but need to figure out the programmatic solution to it. Seems there was a switch from Ordinal DB engine to Atomic DB engine which changes the way backups are taken and thus my restore won’t work. I assume I can detect the engine by querying the DB to be backed up and apply the correct backup…the challenge is if trying to restore to a version that uses a different engine could make restore (or upgrades) very challenging. Will keep you posted.
Sure @steve.hoffman
Thanks for the update.
Tool has been updated to include support for the grafana config database being either in SQLite or moved to Postgres. Note that tool will not do any of the migrations. I did test uprades and it worked to take a backup from PMM 2.39.0 and restore to 2.40.1.
Also fixed the issue with clickhouse backups/restore!