This is a health checking script to monitor the execution of pg_backup_rotated.sh. It will send a daily email with the size of all backups, and a comparison to the previous day.
This does not aim to be a full monitoring solution, but rather a simple way to get notified if the backup script fails for some reason or backups are somehow empty.
Run as a cronjob, you can call a health checking service additionally to get notified if the job fails for some reason.
0 1 * * * /root/backup-health-notifier && curl --silent --output /dev/null --show-error --fail <Some https://healthchecks.io like url>
Set the following environment variables:
POSTMARK_TOKEN=<Postmark Api token>
POSTMARK_TEMPLATE_ID=<ID of the template on Postmark>
BACKUP_PATH=/var/lib/postgresql-backups
PASS_FILE_PATH=/root/.pgpass
CONFIG_FILE_PATH=/root/pg_backup.config
BACKUP_SCRIPT_PATH=/root/pg_backup_rotated.sh
[email protected]
[email protected]
Not pretty, but it does the job.