# The failed backup that looked healthy

A monitoring evaluator reports a healthy backup, but the latest synthetic job
failed and the last successful run is overdue. Diagnose how the evaluator
selects its success heartbeat.

## Before you begin

Use Bash and Python 3. This self-contained simulation does not run a real
backup, timer, remote monitor or AI model. It uses synthetic events and fixed
timestamps for repeatable results; it sends no data and creates no cloud
resources.

## Investigate

```sh
./setup.sh
cat events.json
cat policy.json
python3 monitor.py --events events.json --now 1601
```

The timestamps are seconds on a synthetic clock. A success heartbeat is overdue
when it is more than 120 seconds old. Compare the selected heartbeat with each
job's exit code. Fix the ingestion policy without changing the events, the
freshness window or the evaluator.

```sh
./verify.sh
./teardown.sh
```

Verification checks the original incident and independent healthy, failed and
missing-heartbeat examples. The evaluator reports stale success, not immediate
job-failure notifications: a failure following a still-fresh success does not
produce an immediate alert. A successful process can also back up an empty
directory, so a real deployment still needs source checks and restore tests.
Teardown has no services or cloud resources to remove; re-extract the bundle to
reset the edited policy.

The [related restic/systemd guide and recorded demonstration](https://opsbreakfix.com/devops/monitor-a-restic-backup-from-a-systemd-timer/#see-it-run)
show real backup monitoring, not this simulation.
