Interview Prep/Monitoring & Observability/Prometheus scraping and targets

A target shows `DOWN` on `/targets` with `Get "http://10.0.3.14:9100/metrics": context deadline exceeded`

BeginnerTroubleshootingPrometheus scraping and targets
Answer

Likely causes → The exporter is too slow to answer inside scrape_timeout (default 10s), a security group / NetworkPolicy drops packets, or the host is overloaded.

Diagnose →

time curl -s -o /dev/null -w '%{http_code}\n' http://10.0.3.14:9100/metrics
# from inside the Prometheus pod/host
kubectl exec -n monitoring prometheus-k8s-0 -c prometheus -- wget -qO- -T 5 http://10.0.3.14:9100/metrics | head

Check scrape_duration_seconds{instance="10.0.3.14:9100"} against the timeout.

Fix → Open the port (SG/NACL/NetworkPolicy), disable slow collectors (e.g. node_exporter --no-collector.hwmon on hosts where it hangs), or raise scrape_timeout (must stay ≤ scrape_interval).

Prevent → Alert on up == 0 and on scrape_duration_seconds > 0.8 * scrape_timeout.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Prometheus scraping and targets