Every level, in the open
Observability
4 worlds · 52 levels · 4 bosses
SOLUTION HIDDENTeachers see answer keys in the classroom.
Metrics, logs and alerts: /metrics, PromQL, LogQL, dashboards, alert rules, silences, SLOs, the 3 a.m. page. Worlds 1-3 run in your VM with SIMs that speak the real formats; the last world runs the real Prometheus, Alertmanager, Grafana and Loki on a lab server.
Guided levels show the command first. Alone levels give the goal only. Bosses and exams are timed.
Jump to a world
World 1The Signal Tower
13 levelsEvery service in the fleet whispers numbers. Learn to read them, collect them and ask them questions with PromQL.
Level 1: The whispering pod
Objective: Read the /metrics page of the pod named in ~/obs/TICKET and tell Kern its process_resident_memory_bytes.
A service shows its numbers as plain text on GET /metrics: one sample per line, name{labels} value, with # HELP and # TYPE lines on top. That's the Prometheus exposition format, and curl can read it.
Commands taught
exposition-formatsim-vs-realLevel 2: Only up
Objective: Read api-1's /search requests counter (code 200) twice, 10 seconds apart, and tell Kern how many requests per second it serves.
A counter only goes up (until the process restarts): http_requests_total is every request since the pod started. The number itself means little. Speed is what matters: read it twice, subtract, divide by the seconds.
Commands taught
metric-typessleepLevel 3: Read the YAML
Objective: Build one scrape job in a scratch file, ~/obs/practice.yml, one key at a time, and let promtool check it. The real config is next.
A Prometheus config is YAML: keys with a colon, and indentation (spaces, never tabs) that says what is inside what. A dash starts one item of a list. A scrape job is job_name, static_configs and targets, and labels can tag every series of the job.
Commands taught
yaml-config-basicsprometheus-scrapeLevel 4: Tune the tower
Objective: Add a scrape job named api for 127.0.0.1:8081, :8082 and :8083 to /etc/obs/prometheus.yml, reload Prometheus and see the api targets in hidden.
Prometheus pulls: prometheus.yml lists scrape jobs, each with targets (host:port). Add a job, check the file with promtool check config, then tell the server to re-read it (POST /-/reload). Every scrape also records up{job, instance}: 1 = it answered, 0 = it didn't.
Commands taught
prometheus-scrapepromqlLevel 5: Who went quiet?
Objective: One target stopped answering. Find it with PromQL and tell Kern its instance.
A PromQL selector picks series: up{job="api"}. Add a comparison and only matching series stay: up == 0 is every target whose last scrape failed.
Commands taught
promql-selectorsLevel 6: Pick the series
Objective: Run five selectors, one matcher at a time: a bare name, then =, !=, =~ and !~.
A PromQL selector is a metric name, then label matchers in braces: = equal, != not equal, =~ matches a regex, !~ doesn't match a regex. Label values go in double quotes. Matchers cut a metric down to the series you mean.
Commands taught
promql-selectorsLevel 7: Ask over HTTP
Objective: Run the same query over HTTP with curl, then again with a login.
Everything promql prints comes from Prometheus's HTTP API: GET /api/v1/query?query=EXPR. curl can call it, and when a server wants a login, curl -u USER:PASSWORD sends it (Grafana's admin API needs one).
Commands taught
promqlprometheus-scrapeLevel 8: Speed, not distance
Objective: Tell Kern how many /checkout requests per second (code 200) the pod in ~/obs/TICKET serves, using rate() over 5 minutes.
rate(counter[5m]) = how fast it grew per second over the last 5 minutes, using every sample in that window. It also handles restarts: when a counter drops to 0, rate() counts on from there.
Commands taught
promql-rateLevel 9: Sum it up
Objective: Run six small queries: sum, sum by, topk, a unit conversion, a ratio of two sums and a percentile.
Aggregations fold many series into fewer: sum adds them, by (label) keeps the labels you list, topk(N, ...) keeps the N biggest. Arithmetic works on series: / * + -. A histogram's percentile comes from histogram_quantile.
Commands taught
promql-sum-byhistogram-quantileLevel 10: The loud one
Objective: One api pod is taking far more traffic than its siblings. Find it and tell Kern its name.
sum by (pod) (rate(http_requests_total[5m])) adds up every series of a pod into one number per pod. by keeps the labels you list; everything else is summed away.
Commands taught
promql-sum-byLevel 11: The slow tail
Objective: Tell Kern the fleet-wide p95 latency of /search, in milliseconds.
A histogram counts requests in buckets: _bucket{le="0.25"} = how many took at most 0.25 s. histogram_quantile(0.95, sum by (le) (rate(..._bucket[5m]))) estimates the time 95% of requests stay under (the p95).
Commands taught
histogram-quantileLevel 12: How bad is it?
Objective: PAGER, /checkout is failing: save a PromQL query for the fleet's /checkout error ratio (5xx / all, 0 to 1) to ~/obs/error-ratio.promql.
Errors as a share of traffic: sum(rate(5xx[5m])) / sum(rate(all[5m])). Both sides must be sums so one number comes out (series only divide when their labels match).
Commands taught
error-ratioLevel 13: Night shift: the hot pod
Objective: Scrape the worker pods too, find the pod burning the most CPU, and save a query naming only that pod to ~/obs/hot.promql.
Something in the fleet is burning CPU. Nothing is prepared: scrape what's missing, find the culprit with PromQL, and save a query that names it.
World 2The Log River
11 levelsMetrics say what and where. Logs say why. Fish the right lines out of the river, turn them into numbers, and draw the fleet on one screen.
Level 14: Fishing for errors
Objective: Find the error lines in the api logs and tell Kern what the error message says.
LogQL starts with a stream selector in braces: {app="api"} = every line shipped with the label app=api. Then line filters: |= "text" keeps lines containing it, != drops them, |~ and !~ use a regex.
Commands taught
logclilogql-filtersLevel 15: Read the fields
Objective: Some lines say error but aren't failed requests. Find the path that returns 5xx statuses and tell Kern.
| json turns each JSON field into a label, so you can filter on values: | status >= 500 compares numbers, | level="error" compares text. | logfmt does the same for key=value lines. | line_format "{{.path}}" prints only what you want.
Commands taught
logql-parsersLevel 16: Count the splashes
Objective: Tell Kern which api pod logged the most errors in the last 10 minutes.
Wrap a log query in count_over_time(... [10m]) and every stream becomes a number: lines in the last 10 minutes. sum by (pod) (...) groups them, like PromQL.
Commands taught
logql-metricsLevel 17: A new tributary
Objective: Ship /var/log/obs/worker.log with labels job: fleet and app: worker, then query {app="worker"}.
Logs only reach Loki if a shipper reads them. promtail.yml (or Grafana Alloy) lists files with __path__ and the labels to stick on them. No config, no logs: the most common 'Loki shows nothing' cause.
Commands taught
promtailLevel 18: Lines per second
Objective: Parse the worker's logfmt lines, count lines per second, and say where Loki lives with --addr.
Some apps log key=value text (logfmt) instead of JSON: | logfmt turns its pairs into labels, like | json does. rate({selector}[5m]) counts log lines per second, and sum by (label) groups it. Real logcli needs to know where Loki is: --addr.
Commands taught
logql-parserslogql-metricslogcliLevel 19: Read JSON with jq
Objective: Run four jq filters on the dashboard file, one new idea each.
A Grafana dashboard is a JSON file. jq reads and edits JSON: .title picks a key, | pipes one result into the next step, and { } builds a new object with the keys you choose. The next level uses all three.
Commands taught
dashLevel 20: Paint a panel
Objective: Add a Requests/s panel (fleet-wide sum of rate(http_requests_total[5m]), unit reqps) to ~/obs/shop.json and render it.
A Grafana dashboard is JSON: panels, each with a title, a type, targets[].expr (the query) and fieldConfig.defaults.unit. Teams keep it in git (dashboards as code). dash render draws one here, with sparklines.
Commands taught
dashLevel 21: Dashboards from files
Objective: Write a Grafana provider file one key at a time, then a tiny dashboard as a JSON document.
Grafana can load dashboards from files at start: a provider file (YAML) says where to look, and each dashboard is a JSON document in that folder. A provider has a name, a folder, a type (file) and options with a path.
Commands taught
dashyaml-config-basicsLevel 22: The four golden signals
Objective: Fill in the four empty queries in ~/obs/golden.json (Latency, Traffic, Errors, Saturation) so every panel renders.
Google SRE's four golden signals: Latency (how long), Traffic (how much), Errors (how many fail), Saturation (how full). RED is the request view (Rate, Errors, Duration); USE is the resource view (Utilization, Saturation, Errors).
Commands taught
golden-signalsLevel 23: What and why
Objective: PAGER: /checkout 5xx for ~10 minutes. Find the pod from the metrics and the reason from its logs, and tell Kern both.
Incident method: metrics narrow it down (which service, which pod, since when), then logs explain it (the error message). Don't start by scrolling logs.
Level 24: The flood
Objective: Find the app and the pod flooding the logs, and save a LogQL metric query (lines per pod) to ~/obs/flood.logql.
Log volume suddenly exploded and the log disk is filling. Find which app, then which pod, then save a LogQL query that shows lines per second per pod for that app, for the dashboard.
World 3Pager Duty
13 levelsAlerts wake people up, so every one must be right: the right condition, the right person, quiet when it should be. Then the 3 a.m. page, for real.
Level 25: Rules are YAML
Objective: Build a rule file in a scratch file, one key at a time, check it, and point a config at it.
A rule file is YAML: groups, each with a name and a list of rules. An alert rule has alert, expr, for and labels; a recording rule has record instead. Prometheus finds rule files through rule_files.
Commands taught
alert-rulespromtoolyaml-config-basicsLevel 26: The first alarm
Objective: Write a TargetDown alert (up == 0, for: 1m, hidden) in /etc/obs/rules/fleet.yml and check it with promtool.
An alerting rule is a PromQL expression: every series it returns is an alert. for: 1m means 'true at every evaluation for 1 minute' before it fires. labels (severity) drive routing; annotations (summary) are the human text.
Commands taught
alert-rulespromtoolLevel 27: Not yet
Objective: The rule HighErrorRate just started matching. Tell Kern its state and the pod it's about.
While the expression is true but for: hasn't passed yet, the alert is pending: visible, not sent. Prometheus exposes every alert as a series: ALERTS{alertname, alertstate="pending"|"firing", ...labels}.
Commands taught
alert-statesLevel 28: The routing file
Objective: Build an Alertmanager config in a scratch file, one key at a time, then check it with amtool.
Alertmanager's config is YAML: global settings, a route tree (who gets what, how alerts are grouped and how often they repeat), and receivers (where notifications go: chat, pager, webhooks).
Commands taught
alertmanager-routingamtoolyaml-config-basicsLevel 29: Who gets woken?
Objective: Route severity="page" alerts to the pager receiver in /etc/obs/alertmanager.yml; everything else stays on chat.
Prometheus sends firing alerts to Alertmanager, which routes them: the top route has a default receiver; child routes with matchers send matching alerts elsewhere. The first matching child wins.
Commands taught
alertmanager-routingamtoolLevel 30: Planned quiet
Objective: worker-2 (127.0.0.1:8092) is down for 2 hours of planned maintenance. Silence only its TargetDown alert, with a comment.
A silence mutes alerts whose labels match ALL its matchers, for a fixed time, with a comment. Match as narrowly as you can: a silence on alertname alone hides that alert for the whole fleet.
Commands taught
amtool-silenceLevel 31: Who silenced it?
Objective: Add a short silence with an author, then read it back.
A silence should say who made it and why. --author names the person, --comment gives the reason, --duration says how long. hidden shows all of them.
Commands taught
amtool-silenceLevel 32: The error budget
Objective: Do the error-budget math for a 99.9% / 30-day SLO with Kern.
An SLO is a target, like 99.9% of requests succeed over 30 days. The other 0.1% is the error budget you may spend. Burn rate = how fast you spend it: error ratio now / allowed ratio. Burn rate 1 = the budget lasts exactly 30 days.
Commands taught
slo-budgetLevel 33: And, or, unless
Objective: Run three queries, one operator each.
and, or and unless combine two sets of series. A and B keeps the series of A that also exist in B. A or B gives both sets. A unless B keeps A without the ones in B. The burn-rate alert next uses and: both windows must agree.
Commands taught
promql-selectorsburn-rate-alertsLevel 34: Burning too fast
Objective: Write ErrorBudgetBurn (99.9% SLO, burn rate 14.4 over 1h and 5m, severity page) in /etc/obs/rules/slo.yml. It must fire now and stay quiet on a normal day.
A multiwindow burn-rate alert pages when the budget burns at 14.4x over the last hour AND still over the last 5 minutes: fast, real problems page; ones already over stop paging quickly. Join the two conditions with and.
Commands taught
burn-rate-alertsLevel 35: Crying wolf
Objective: CheckoutErrors pages on every single 500. Fix it in /etc/obs/rules/fleet.yml so it stays quiet on a normal day but fires on the outage happening now.
Alert fatigue: an alert that fires on normal noise teaches people to ignore pages. Alert on symptoms as a ratio (failed / all) above a threshold that a normal day never reaches, held for a few minutes.
Commands taught
alert-fatigueLevel 36: Name the culprit
Objective: PAGER: one pod is failing a lot of requests. Write PodErrorRatio in /etc/obs/rules/fleet.yml so it fires for that pod only, and never on a normal day.
A per-pod alert keeps the pod label (sum by (pod) on both sides of the ratio), so the page names the culprit instead of 'the fleet is sad'.
Level 37: The 3 a.m. page
Objective: Work the page: name the pod, name the cause, silence just that alert for the fix window, and write ~/obs/postmortem.md.
A real incident from page to postmortem: find what's paging, find why, keep the noise down while the fix rolls out, then write it up blamelessly so it doesn't happen again.
Commands taught
postmortem
World 4The Monitoring Company
15 levelsFirst job at a monitoring company: a real Prometheus, Alertmanager, Grafana and Loki, a client's fleet and a Black Friday page, with no simulators.
Level 38: Your own Prometheus
Objective: Add a scrape job named shop for 127.0.0.1:8000 to ~/noc/prometheus/prometheus.yml, check it with promtool, reload, and see the target up.
This box runs a real Prometheus (:9090), node_exporter (:9100) and a web shop (:8000), and Prometheus scrapes only what scrape_configs lists. After an edit: promtool check config, then reload (POST /-/reload); your files are in ~/noc because /etc is read-only here.
Commands taught
ob4-your-boxob4-prometheus-ymlob4-prom-apiLevel 39: Ask the engine
Objective: Save in ~/noc/queries/rate.promql a query that gives the shop's requests per second for each path, over the last minute.
PromQL runs on the server: ask it with promtool query instant URL 'EXPR' or over the HTTP API (curl localhost:9090/api/v1/query --data-urlencode 'query=...'). Saved queries live in files the team shares.
Commands taught
ob4-saved-queriesLevel 40: The client's fleet
Objective: On Acme's Prometheus (:9091), save in ~/noc/queries/acme-busiest.promql a query returning only the busiest service of job company (req/s over 5m).
Our client Acme Parcel Co. has its own central Prometheus, and you get a read-only door to it on :9091 (queries yes, reloads and admin no). It is a real company with real traffic, so the answer changes every second.
Commands taught
ob4-tenantsLevel 41: Slow checkout
Objective: Customers say checkout is slow, so save in ~/noc/queries/p95.promql the p95 latency of every shop path over 5 minutes.
Latency lives in a histogram: _bucket counters with an le label (less or equal). histogram_quantile(0.95, ...) reads the 95th percentile from the bucket rates, so keep le in the by (...).
Level 42: Remember the answer
Objective: Record path:http_requests:rate1m (per-path request rate over 1m, job shop) in ~/noc/prometheus/rules/shop.yml, load it via rule_files, check, reload.
A recording rule evaluates an expression on every evaluation and stores the result as a new series that dashboards and alerts read cheaply. Name them level:metric:operations, and list the rule files under rule_files.
Commands taught
ob4-recording-rulesLevel 43: Wake me if it dies
Objective: Write alert TargetDown in ~/noc/prometheus/rules/alerts.yml (up == 0 for 15s, hidden, a summary naming the instance); make it fire.
An alerting rule: alert NAME, expr that returns series while something is wrong, for: how long it must stay true, labels (severity) and annotations ({{ $labels.instance }} fills in per alert). /api/v1/alerts shows pending and firing alerts.
Commands taught
ob4-alerts-realLevel 44: Who gets woken up
Objective: Do the ticket in ~/noc/TICKET (pages to the pager, everything else to tickets), test the routes, reload, and see both arrive with pager.
Alertmanager decides who hears about an alert. route: a tree; the root receiver is the default, child routes match labels (matchers). Receivers here are webhooks to the lab pager on :9095. amtool config routes test shows where an alert would go.
Commands taught
ob4-alertmanager-realob4-pagerLevel 45: Quiet, precisely
Objective: The node exporter (127.0.0.1:9100) has an hour of planned maintenance, so silence its TargetDown for 1h with a comment while the other dead target still pages.
A silence mutes alerts that match ALL its matchers, for a set time, with a comment. Too wide a silence hides the next real outage. amtool silence add alertname=X instance=Y --duration=1h --comment='why'.
Level 46: Logs on the river
Objective: Save in ~/noc/queries/errors.logql a LogQL query that returns only the shop's log lines with a 5xx status.
The shop's JSON logs go to the company's shared Loki, in your own tenant. LogQL: a selector {app="shop"}, then filters; | json turns fields into labels to filter on (status >= 500). logcli is the CLI; with no --org-id it reads your own tenant, where the shop's logs are.
Commands taught
ob4-logcli-realLevel 47: The shop's deploy tool
Objective: Meet shopctl: look at the shop, read its logs, roll back one version and empty the cache.
shopctl is the shop's own deploy tool: status shows the version, the deploy history and the replicas; rollback goes back one version; cleanup empties a data dir (tmp or cache, never uploads). Real teams have the same verbs in their CD system.
Commands taught
ob4-shopctlLevel 48: Count the splashes
Objective: Save in ~/noc/queries/top-errors.logql a LogQL metric query returning only the path with the most 5xx lines in the last 5 minutes.
count_over_time({...} [5m]) turns log lines into numbers per stream; sum by (path) groups them by a parsed field, and topk(1, ...) keeps the worst. logcli instant-query runs metric queries.
Level 49: A dashboard from a file
Objective: Grafana runs on :3000 (admin / noc): do ~/noc/TICKET, provisioning the dashboard shop-golden from files with three panels.
Grafana dashboards are JSON that teams keep in git and let Grafana load through a provider file (provisioning/dashboards/*.yml) pointing at a folder. A panel has a type, a datasource (uid prom or loki) and targets with an expr.
Commands taught
ob4-grafana-provisioningLevel 50: Burning the budget
Objective: Do ~/noc/TICKET: record the error ratio over 5m and 1h and alert ShopErrorBudgetBurn when both burn above 14.4 (Kern replays it on 3 h of history).
SLO: 99% of shop requests succeed, so the error budget is 1% and burn rate = error ratio / 1%. The SRE workbook pages when the burn is above 14.4 over 1h AND over 5m: the long window proves it matters, the short one that it's still happening.
Commands taught
ob4-burn-rate-realLevel 51: On call: the noisy night
Objective: At 02:47 the pager won't stop: do the 3 items in ~/noc/TICKET (routing, the decommissioned exporter, the shop's disk).
On call is triage: stop the noise, keep the signal, fix what's real. A page must be urgent and actionable (everything else is a ticket), and decommissioned things get removed, or silenced with a comment until they are.
Commands taught
ob4-shopctlLevel 52: Boss: Black Friday
Objective: ShopHighErrorRate is paging: run the incident like a pro, with the 5 steps in ~/noc/TICKET.
A real incident, end to end: mitigate first, with evidence; confirm recovery from the monitoring itself; leave the next on-call a dashboard and a postmortem. shopctl is the shop's deploy tool.
For teachers
Use these levels with a class
SOLUTION HIDDEN Teachers see answer keys in the classroom.