Minimal scrape configuration
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ["prometheus:9090"]- Read the evidence before deciding what it means.
- Prefer a hypothesis that explains multiple independent signals.
Learn the Prometheus pull model, scrape targets, service discovery concepts, time-series storage and why target health is part of telemetry reliability.
Prometheus periodically performs HTTP scrapes of configured or discovered targets. Each scrape records timestamped samples for metric names and label sets.
A target marked DOWN may mean DNS, routing, TLS, authentication, endpoint, exporter or application failure. `up == 0` describes scrape failure; it does not by itself prove why the target failed.
Monitoring systems need capacity, retention, HA and their own health checks. A missing metric can be an instrumentation or collection-path failure rather than healthy behavior.
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ["prometheus:9090"]Goal: Model targets and detect one intentionally unreachable endpoint.
python3 - <<'PY'
import socket,threading
server=socket.socket(); server.bind(('127.0.0.1',0)); up_port=server.getsockname()[1]; server.listen()
def accept_once():
c,_=server.accept(); c.close(); server.close()
threading.Thread(target=accept_once,daemon=True).start()
unused=socket.socket(); unused.bind(('127.0.0.1',0)); down_port=unused.getsockname()[1]; unused.close()
def probe(port):
s=socket.socket(); s.settimeout(.5)
try: s.connect(('127.0.0.1',port)); return 'up'
except OSError: return 'down'
finally: s.close()
print('reachable target:',up_port,probe(up_port))
print('unreachable target:',down_port,probe(down_port))
PYA failed TCP/HTTP probe proves the collection path cannot reach that endpoint. It does not, by itself, identify the application root cause.
Check target address/path, DNS/routing, TLS/authentication, exporter/application endpoint, then Prometheus target details before changing the application.
Telemetry that cannot be collected is itself an operational failure requiring monitoring.
Use the Prometheus HTTP API to inspect actual target health.
cd labs/observability-stackdocker compose up -dcurl -fsS http://127.0.0.1:9090/api/v1/targetsThree concept checks plus one scenario check. Open each answer only after deciding first.
Fetches metric samples from a target endpoint at an interval and stores them as time series.
Prometheus could not successfully scrape that target; further diagnosis is required.
Collection, storage and query paths can fail independently of the application.
A shared collection-path problem such as Prometheus networking, DNS, credentials or configuration.
Progress is saved in this browser immediately. When you sign in to My Learning, it can also sync across devices.
Attempt the core lab and knowledge checks before marking the module complete.