How would you monitor a public API from the outside?
BeginnerScenarioAlerting and On-Call Design
Answer
Situation read → Internal metrics cannot see DNS, CDN, certificate or routing failures. External probes can.
What I'd do →
- Deploy blackbox_exporter in at least two locations outside your cluster.
- Define a module that checks status, TLS and latency.
- Scrape it through a probe:
scrape_configs:
- job_name: blackbox-http
metrics_path: /probe
params: {module: [http_2xx]}
static_configs: [{targets: ["https://api.example.com/health"]}]
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115
- Alert on
probe_success == 0for 2 minutes from multiple locations.
Why → The user's view of your service is what you must measure first.
Interview tip → Alert only when more than one probe location fails, to avoid a single bad prober paging you.
More on Alerting and On-Call Design
Your on-call engineers receive 300 alerts a night and have started ignoring the pager. How do you fix it?IntermediateYou are asked to design alerting for a brand-new HTTP service from scratch. What do you alert on?BeginnerA "CPU above 90%" alert wakes someone at 3 a.m., but users saw no impact. What do you change?BeginnerA new hire asks: "Should we page on symptoms or causes?" How do you answer with an example?BeginnerDesign burn-rate alerts for a 99.9% availability SLO over 30 days.AdvancedPayments and platform teams share one Prometheus and one Alertmanager. How do you route alerts to the right team and severity?Intermediate