Backups that nobody verifies are barely better than no backups at all. Every sysadmin has heard horror stories: the backup job that silently failed three months ago, the corrupted archive that can't be restored, the backup directory that filled up and stopped writing. Backup monitoring is not optional β it's essential.
This guide covers comprehensive backup monitoring on Linux using dargslan-backup-monitor, a free Python tool that checks backup freshness, verifies file integrity, and tracks disk usage trends.
The Backup Monitoring Problem
Most backup failures are silent. The backup job runs, encounters an error, and nobody notices until restore time. Common failure modes include:
- Stale backups β The cron job stopped running and nobody noticed
- Corrupted archives β Disk errors or incomplete writes produce unusable backups
- Disk full β Backup directory runs out of space, new backups aren't written
- Missing databases β Backup script was updated but a new database wasn't added
- Retention overflow β Old backups accumulate and consume all storage
Installing dargslan-backup-monitor
pip install dargslan-backup-monitor
# Or install the complete toolkit
pip install dargslan-toolkit
CLI Usage
# Full backup status report
dargslan-backup report /backup
# Check freshness (default: 24 hours)
dargslan-backup check /backup --max-age 48
# List all backup files
dargslan-backup list /var/backups
# Verify file integrity
dargslan-backup checksum /backup/db-2026-04-01.sql.gz
# JSON output
dargslan-backup json
Python API
from dargslan_backup_monitor import BackupMonitor
# Custom backup directories
bm = BackupMonitor(backup_dirs=["/backup", "/var/backups", "/mnt/nfs/backup"])
# Full report
bm.print_report()
# Find all backup files
backups = bm.find_backups("/backup")
for b in backups:
print(f" {b['status']:6} {b['size_human']:>10} {b['age_human']:>20} {b['filename']}")
# Check freshness
result = bm.check_freshness(max_age_hours=24)
if not result['all_fresh']:
print(f"WARNING: {len(result['stale'])} stale backups!")
# Verify checksum
cs = bm.verify_checksum("/backup/db.sql.gz")
print(f"SHA256: {cs['checksum']}")
# Disk usage analysis
usage = bm.disk_usage_trend()
print(f"Total backup size: {usage['total_size_human']}")
Linux Backup Best Practices
The 3-2-1 Rule
- 3 copies of your data
- 2 different storage media (local disk + NFS/S3/tape)
- 1 off-site copy (different data center or cloud)
Backup with tar
# Full system backup
tar czf /backup/full-$(date +%F).tar.gz \
--exclude=/proc --exclude=/sys --exclude=/tmp \
--exclude=/backup --exclude=/dev /
# Incremental backup with snapshot
tar --listed-incremental=/backup/snapshot.snar \
-czf /backup/incr-$(date +%F).tar.gz /data
# Verify archive integrity
tar tzf /backup/full-2026-04-01.tar.gz > /dev/null && echo "OK"
Database Backups
# PostgreSQL
pg_dump dbname | gzip > /backup/pg-$(date +%F).sql.gz
pg_dumpall | gzip > /backup/pg-all-$(date +%F).sql.gz
# MySQL/MariaDB
mysqldump --all-databases --single-transaction | \
gzip > /backup/mysql-$(date +%F).sql.gz
# MongoDB
mongodump --out /backup/mongo-$(date +%F)/
# Redis
redis-cli BGSAVE
cp /var/lib/redis/dump.rdb /backup/redis-$(date +%F).rdb
Rsync for Mirror Backups
# Local mirror
rsync -avz --delete /data/ /backup/data-mirror/
# Remote backup via SSH
rsync -avz -e ssh /data/ user@backup-server:/backup/data/
# With bandwidth limit
rsync -avz --bwlimit=10000 /data/ /backup/
Integrity Verification
# Generate checksums after backup
sha256sum /backup/*.tar.gz > /backup/checksums.sha256
# Verify checksums
sha256sum -c /backup/checksums.sha256
# Using dargslan-backup-monitor
from dargslan_backup_monitor import BackupMonitor
bm = BackupMonitor()
# Verify with different algorithms
for algo in ['sha256', 'md5', 'sha1']:
result = bm.verify_checksum("/backup/db.sql.gz", algorithm=algo)
print(f" {algo}: {result['checksum']}")
Automated Backup Monitoring Script
#!/usr/bin/env python3
# /opt/scripts/backup-check.py
from dargslan_backup_monitor import BackupMonitor
bm = BackupMonitor(backup_dirs=["/backup"])
# Check freshness
result = bm.check_freshness(max_age_hours=24)
if result['total'] == 0:
print("CRITICAL: No backup files found!")
elif not result['all_fresh']:
print(f"WARNING: {len(result['stale'])} stale backups")
for b in result['stale']:
print(f" STALE: {b['filename']} ({b['age_human']})")
else:
print(f"OK: All {result['total']} backups are fresh")
# Check total backup size
usage = bm.disk_usage_trend()
if usage.get('total_size', 0) > 50 * 1024**3: # 50 GB
print(f"WARNING: Backup storage at {usage['total_size_human']}")
πΎ Master Backup & Disaster Recovery
Our Linux administration eBooks cover backup strategies, disaster recovery planning, rsync, Bacula, BorgBackup, and cloud backup integration.
Browse Linux Books βBackup monitoring closes the gap between "we have backups" and "we can actually restore." dargslan-backup-monitor makes it simple to verify freshness, check integrity, and track storage usage β all from the command line or Python scripts.
Install now: pip install dargslan-backup-monitor β or get all 15 tools: pip install dargslan-toolkit
Download our free Backup Monitor Cheat Sheet for quick reference.