Never again discover a backup failed on the day you need it.
Backups are your safety net. But they can fail silently for weeks.
This guide shows you how to monitor your backup scripts with MoniTao Heartbeat.
Backups can fail for many reasons:
Integrate heartbeat into your backup script:
Create a job with your backup interval (e.g., 24h for daily backup).
Copy the ping_token and api_secret from the MoniTao dashboard.
Here's a complete bash script example with integrated heartbeat:
#!/bin/bash
# Script de backup MySQL avec heartbeat MoniTao
TOKEN="VOTRE_PING_TOKEN"
SECRET="VOTRE_API_SECRET"
API="https://monitao.com/api/heartbeat"
# Signal de debut
curl -s -X POST "$API/start/$TOKEN" -H "Authorization: Bearer $SECRET"
# Variables
DATE=$(date +%Y%m%d_%H%M%S)
BACKUP_DIR="/backups"
DB_NAME="production"
DB_USER="backup_user"
DB_PASS="secure_password"
# Execution du backup
mysqldump -u $DB_USER -p"$DB_PASS" $DB_NAME | gzip > "$BACKUP_DIR/db_$DATE.sql.gz"
RESULT=$?
# Verification et signal
if [ $RESULT -eq 0 ] && [ -f "$BACKUP_DIR/db_$DATE.sql.gz" ]; then
# Backup reussi
curl -s -X POST "$API/ping/$TOKEN" -H "Authorization: Bearer $SECRET"
# Nettoyage des vieux backups (garder 7 jours)
find $BACKUP_DIR -name "db_*.sql.gz" -mtime +7 -delete
else
# Backup echoue
curl -s -X POST "$API/fail/$TOKEN" -H "Authorization: Bearer $SECRET"
exit 1
fi
Heartbeat works with all types of backups:
Check the backup command's return code before sending the success ping.
Yes, the principle is the same: ping after each successful execution.
Configure a 3-4h grace to give time for the backup to complete.
No, MoniTao only alerts. Restart must be handled by your script or system.
Start free, no credit card required.