diff --git a/templates/postgres/configmap_backup_monitoring.yaml b/templates/postgres/configmap_backup_monitoring.yaml index 96972c0..9eb5365 100644 --- a/templates/postgres/configmap_backup_monitoring.yaml +++ b/templates/postgres/configmap_backup_monitoring.yaml @@ -10,9 +10,9 @@ data: echo "`date` INFO script was executed" >> /tmp/monitoring_cron_status.log - LAST_BKP=$(envdir "/run/etc/wal-e.d/env" wal-g backup-list --detail --json | jq -r .[-1].finish_time) + LAST_BASE_BACKUP_MODIFIED_DATE=$(envdir "/run/etc/wal-e.d/env" wal-g backup-list | grep base_ | tail -n 1 | awk '{print $2}') - LAST_BKP_DATE_IN_UNIXSEC=$(date -d ${LAST_BKP} +"%s") + LAST_BASE_BACKUP_DATE_IN_UNIXSEC=$(date -d ${LAST_BASE_BACKUP_MODIFIED_DATE} +"%s") STAGE={{ .Release.Name | lower | replace "-" "_" }} - echo "pg_basebackup_successful_timestamp_${STAGE} ${LAST_BKP_DATE_IN_UNIXSEC}" | curl --data-binary @- "{{ .Values.postgres.monitoring.prometheusPushgatewayURL }}" + echo "pg_basebackup_successful_timestamp_${STAGE} $LAST_BASE_BACKUP_DATE_IN_UNIXSEC" | curl --data-binary @- "{{ .Values.postgres.monitoring.prometheusPushgatewayURL }}"