Verify Backup Freshness and Restore-Test Coverage With Python
Before you begin
- Applies to:Backup and restore evidence reporting with Python 3.10 or later.
- Where to start:Start on the machine approved to process the backup records.
- What you need:Have a protected asset inventory and approved backup job and restore exports.
Guide tools
Downloads
Steps
List all protected assets
Save this illustrative inventory as inventory.json. Use one stable identifier per asset so a missing export row cannot hide a machine.
["db-01", "web-01"]Normalize the evidence export
Save as evidence.csv. Use kind backup or restore and result success or failure. Supply ISO 8601 timestamps with offsets. The newest outcome per asset and kind wins, with failures taking precedence when timestamps tie.
asset,kind,result,completed_atdb-01,backup,success,2026-11-19T06:00:00Zdb-01,restore,success,2026-11-10T12:00:00Zweb-01,backup,failure,2026-11-19T06:00:00ZRun a reproducible check
With the pinned time, db-01 has current evidence for both checks. Web-01 has a failed backup and missing restore evidence. Adjust the backup-hours and restore-days thresholds to match your recovery objectives.
python backup_freshness.py inventory.json evidence.csv --as-of 2026-11-19T12:00:00ZSchedule and verify the handoff
VerifyOmit the pinned time in production. Exit 0 means all evidence is current, 1 means an asset needs review, and 2 means input prevented the report. Send failed jobs to the backup owner and overdue test restores to the recovery owner. Use a test restore to verify the intended workload at an approved location.
References
Your feedback keeps these production procedures accurate and battle-tested.