Recall first: read each stage's one-line summary and try to remember its commands. Then open the stage to check yourself.
9 stages51 commands
uptimeLoad average over 1, 5 and 15 minutes
nprocNumber of CPU cores, to compare with the load average
free -mMemory in MB; read the available column, not free
df -hDisk use per filesystem, saturation at a glance
journalctl -p err -b -n 20The last 20 error-level log entries since boot
curl -o /dev/null -s -w "%{http_code} %{time_total}\n" https://example.comStatus code and total time for one request (errors and latency)
Watch for A load average above nproc means work is queueing, even if CPU graphs look calm.
docker exec prometheus promtool check config /etc/prometheus/prometheus.ymlValidate the config and rule files before a restart
docker exec prometheus promtool query instant http://localhost:9090 'up'Run an instant query from the command line; 1 means the scrape worked
curl -s localhost:9100/metrics | grep -vc '^#'Count the series node_exporter serves
node_filesystem_avail_bytes{mountpoint="/", fstype!="tmpfs"}Select series with label matchers
100 * (1 - avg by (instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])))CPU busy as a percentage per machine
histogram_quantile(0.95, sum by (le) (rate(prometheus_http_request_duration_seconds_bucket[5m])))p95 latency from a histogram; keep the le label
node_load1 / on (instance) count by (instance) (node_cpu_seconds_total{mode="idle"})Load per CPU core, matching both sides on instance only
predict_linear(node_filesystem_avail_bytes{mountpoint="/"}[1h], 4*3600) / 1e9Free disk in GB projected 4 hours ahead
Watch for Every unique label value is a new series. User IDs or full URLs as labels run Prometheus out of memory.
Open the lesson: Prometheus and PromQL →docker run -d --name grafana --network mon -p 3000:3000 grafana/grafanaStart Grafana on the same network as Prometheus
curl -s localhost:3000/api/healthCheck Grafana is up and see its version
curl -s -u admin:admin localhost:3000/api/datasourcesList data sources; provisioned ones show readOnly true
curl -s -u admin:admin "localhost:3000/api/search?query=node"Confirm a provisioned dashboard loaded, with its folder
label_values(node_uname_info, instance)Query for an instance variable listing every node_exporter host
100 * (1 - avg by (instance) (rate(node_cpu_seconds_total{mode="idle", instance=~"$instance"}[5m])))CPU used panel filtered by the dashboard variable
Watch for A single panel saying "No data" is usually a bad query. Run it in Explore.
Open the lesson: Grafana dashboards →docker exec prometheus promtool check rules /etc/prometheus/rules.ymlValidate alert and recording rules
docker exec alertmanager amtool check-config /etc/alertmanager/alertmanager.ymlValidate the Alertmanager config before a reload
amtool config routes --config.file=/etc/alertmanager/alertmanager.ymlPrint the routing tree
amtool config routes test --config.file=/etc/alertmanager/alertmanager.yml severity=page alertname=TargetDownShow which receiver a set of labels would reach
amtool silence add --alertmanager.url=http://localhost:9093 \
alertname=TargetDown instance=node-exporter:9100 \
--duration=2h --author=rajeev --comment="Planned reboot of node-exporter host"Silence an alert for planned work, with an author, comment and end time
amtool alert query -s --alertmanager.url=http://localhost:9093List alerts including silenced ones, shown as suppressed
curl -s localhost:9090/api/v1/alertmanagersCheck that Prometheus found Alertmanager
Watch for up == 0 can't fire for a target that vanished entirely. Add absent(up{job="..."}) for critical jobs.
Open the lesson: Alerting with Alertmanager →docker run -d --name loki --network mon -p 3100:3100 grafana/lokiStart Loki next to Prometheus and Grafana
curl -s localhost:3100/readyCheck Loki is ready to accept logs
curl -s localhost:3100/loki/api/v1/labelsList the label names Loki knows
curl -s localhost:3100/loki/api/v1/label/container/valuesList the values of one label
{container="hotrod"} |= "ERROR"Keep only lines containing ERROR from one stream
sum by (container) (count_over_time({host="lab-1"}[5m]))Turn log lines into a count per container
alloy convert --source-format=promtailTranslate an old Promtail config to Alloy
Watch for Centralised logs centralise leaked secrets too. Mask them before shipping and set a retention period.
Open the lesson: Centralised logs with Loki →docker run -d --name jaeger --network mon -p 16686:16686 -p 4317:4317 -p 4318:4318 jaegertracing/jaegerRun Jaeger with its UI and OTLP gRPC and HTTP ports
opentelemetry-instrument python app.pyZero-code instrumentation for a Python app
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318Tell the SDK where to send OTLP over HTTP
curl -s localhost:16686/api/traces/<trace-id> > ~/trace.jsonFetch one trace from Jaeger's API
{container="hotrod"} |= "9881c56bd9002eeee8637029115c5b57"Every log line of one request, by its trace ID
Watch for Sequential spans of the same call, like fourteen GetDriver calls in a row, are an N+1 pattern. Batch them.
Open the lesson: Tracing with OpenTelemetry and Jaeger →helm repo add prometheus-community https://prometheus-community.github.io/helm-chartsAdd the chart repository
helm install monitoring prometheus-community/kube-prometheus-stack \
--namespace monitoring --create-namespaceInstall the stack with release name monitoring
kubectl get pods -n monitoringCheck the operator, Prometheus, Grafana and exporters are running
kubectl port-forward -n monitoring svc/monitoring-kube-prometheus-prometheus 9090Reach the Prometheus UI from your machine
kubectl port-forward -n monitoring svc/monitoring-grafana 3000:80Reach Grafana from your machine
kubectl get servicemonitor -n shopList ServiceMonitors in a namespace
increase(kube_pod_container_status_restarts_total[1h]) > 0Containers that restarted in the last hour
kube_pod_container_status_last_terminated_reason{reason="OOMKilled"} == 1Containers whose last restart was an OOM kill
Watch for A missing target is almost always the release label, the selector, or a port number instead of the port name.
Open the lesson: Monitoring Kubernetes →sum(rate(hotrod_requests_total{endpoint="GET_/dispatch", error="false"}[30d]))
/ sum(rate(hotrod_requests_total{endpoint="GET_/dispatch"}[30d]))Availability SLI over 30 days
sum(rate(hotrod_request_latency_bucket{endpoint="GET_/dispatch", le="1"}[30d]))
/ sum(rate(hotrod_request_latency_count{endpoint="GET_/dispatch"}[30d]))Latency SLI, share of requests within 1 second
systemctl status node_exporterFirst runbook step for TargetDown on a server
Watch for Don't promise more than you depend on. A 99.99% SLO on a 99.95% database is a wish.
Open the lesson: SLOs, error budgets and on-call →SELECT average(duration) FROM Transaction FACET name SINCE 1 hour agoAn NRQL query in New Relic, average duration per transaction
Watch for Set an ingestion cap or usage alert on day one, or a runaway debug log shows up on the invoice.
Open the lesson: Hosted monitoring: Datadog, New Relic and Dynatrace →