$ run as a normal user# run as root (or with sudo)
Skills in this chapter
- Monitoring and load tests — 7
Prometheus — metrics
Prometheus scrapes numbers from every target every 15–30 s; promtool checks its config and rules.
node_exporter — server metrics
node_exporter gives CPU, memory, disk and network numbers of a Linux server on port 9100.
Grafana — dashboards
Grafana shows metrics, logs and traces in dashboards; grafana-cli installs plugins and resets the admin password.
grafana-cli plugins install grafana-piechart-panel
systemctl restart grafana-serverLoki — logs
Loki stores logs with labels; logcli queries them from the terminal.
OpenTelemetry Collector — one pipe for all signals
otelcol receives traces, metrics and logs (OTLP), processes them and sends them to any backend.
k6 and ab — load tests
k6 runs scripted load tests with pass/fail thresholds; ab is a quick one-URL benchmark.
Alert on symptoms, not on causes
Good alerts tell you users have a problem; the dashboards then show why.
- Watch the 4 golden signals: latency, traffic, errors, saturation.
- Alert on an error rate or slow p95 latency over 5–10 minutes — not on one CPU spike.
- Every alert has a runbook link: what to check, how to fix.
- Define SLOs ("99.9 % of requests OK per month") and alert on the error budget.
Remember
An alert nobody acts on is noise. Delete it or fix it.