From 5b34927ffd6fe04297608225c9a938c60965678b Mon Sep 17 00:00:00 2001 From: Petru Paler Date: Mon, 15 Jan 2024 13:25:04 +0000 Subject: [PATCH] Ping pushgateway after successful backup. --- services/mysql-backup.hcl | 4 +++- services/postgres-backup.hcl | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/services/mysql-backup.hcl b/services/mysql-backup.hcl index df605e1..046452e 100644 --- a/services/mysql-backup.hcl +++ b/services/mysql-backup.hcl @@ -21,7 +21,9 @@ job "mysql-backup" { data = < /data/compute/appdata/db-backups/mysql/backup.sql + mysqldump -u root --password="$MYSQL_ROOT_PASS" --all-databases > /data/compute/appdata/db-backups/mysql/backup.sql && \ + echo "last_success $(date +%s)" | \ + /run/current-system/sw/bin/curl --data-binary @- http://pushgateway.service.consul:9091/metrics/job/mysql_backup EOH } diff --git a/services/postgres-backup.hcl b/services/postgres-backup.hcl index abc8507..d51810e 100644 --- a/services/postgres-backup.hcl +++ b/services/postgres-backup.hcl @@ -21,7 +21,9 @@ job "postgres-backup" { data = < /data/compute/appdata/db-backups/postgresql/backup.sql + pg_dumpall -U postgres > /data/compute/appdata/db-backups/postgresql/backup.sql && \ + echo "last_success $(date +%s)" | \ + /run/current-system/sw/bin/curl --data-binary @- http://pushgateway.service.consul:9091/metrics/job/postgres_backup EOH }