The missing target that raised no alert
A Prometheus alert notices a failed scrape but goes silent when its target disappears from the time series. Repair the rule and verify both conditions.

The scenario
The API target's up metric can be zero or absent. The existing alert covers only a failed scrape. Detect both a failed target and a target missing for five minutes without alerting on healthy data.
Mission objectives
- Compare failed and absent time series in real Prometheus rule tests.
- Extend the alert to detect sustained missing telemetry.
- Verify healthy, down and absent cases with promtool.
Lab README
The missing target that raised no alert
A Prometheus rule detects up == 0, but stops alerting when the target's
series disappears altogether. Detect both cases and keep healthy targets
quiet.
Before you begin
Use Docker, Bash and Python 3 on a disposable machine. The lab runs the
official Prometheus promtool in disposable containers with no network or
host ports, using fixed synthetic series. Docker may download the image and
uses local disk and compute. No live Prometheus server or real incident data is
used. The tests demonstrate rule semantics, not an entire monitoring system.
./setup.sh
./lab.sh
Inspect rules.yml and the test cases. Extend the alert expression in
rules.yml so it detects both a failed scrape and absence for five minutes.
Keep the alert name and severity, and do not change cases.yml or the runner.
./verify.sh
./teardown.sh
Verification checks the original test fixtures and runs the actual Prometheus rule evaluator. Teardown does not remove the shared Docker image or edited files; re-extract the bundle to reset the incident.
Get the lab
Download and inspect the installer before running it. It checks the archive's SHA-256 digest and refuses to overwrite an existing lab directory.
curl -fsSLO https://devops.download/labs/aiops-04-prometheus-missing-target.sh less aiops-04-prometheus-missing-target.sh
bash aiops-04-prometheus-missing-target.sh
cd labs/aiops-04-prometheus-missing-target
./setup.shWhen you've made your changes, run ./verify.sh. Remove lab resources with ./teardown.sh.
Need a nudge?
Hint #1
A missing time series is not the same as a present series whose value is zero.
Hint #2
Combine the existing failed-scrape expression with an absence check over a five-minute window.
Hint #3 · Learning paths on opsbreakfix.com
Solved it?
Continue learning with the paths on opsbreakfix.com.
Continue to opsbreakfix.com ↗