You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

20 lines
593 B

METRICS_LOCATION=$1
START=$2
END=$3
SIZE=$4
# Write to a temporary file invisible to prometheus
cat > $(pwd)/postgres_backup.prom.$$ <<EOT
# HELP postgres backup start time, in unixtime.
# TYPE postgres_backup_start gauge
postgres_backup_backup_start ${START}
# HELP postgres_backup_end backup end time, in unixtime.
# TYPE postgres_backup_end gauge
postgres_backup_end ${END}
# HELP postgres_backup_size backup size, in bytes.
# TYPE postgres_backup_size gauge
postgres_backup_size ${SIZE}
EOT
# Atomic move so prometheus can see it
mv $(pwd)/postgres_backup.prom.$$ "/metrics/metrics.txt"