Skip to content

Verify Backup Freshness and Restore-Test Coverage With Python

Admin
November 20, 2026
5 min read
Intermediate
πŸ’» Target OS: Windows / Linux (Python 3.10+)

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
Guide tools
0/0 Steps (0%)

Downloads

Steps

01

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"]
02

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_at
db-01,backup,success,2026-11-19T06:00:00Z
db-01,restore,success,2026-11-10T12:00:00Z
web-01,backup,failure,2026-11-19T06:00:00Z
03

Run 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.

Terminal window
python backup_freshness.py inventory.json evidence.csv --as-of 2026-11-19T12:00:00Z
04

Schedule and verify the handoff

Verify

Omit 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

Comments