How to to backup Alert Templates and Alert Rules

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.

Hi @Roma_Novikov

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?

Hi @Roma_Novikov

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.

1 Like

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.