Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

Chapter 10Name in the course: Monitoring and load tests

Monitor, log and load test

You cannot run what you cannot see. Metrics show the trend (Prometheus), logs show the details (Loki), traces show the path of one request (OpenTelemetry), and dashboards and alerts put it in front of people (Grafana, Alertmanager). Load tests show the limits before users find them.

  • 7 Lessons
  • 10 Commands

$ run as a normal user# run as root (or with sudo)

Skills in this chapter

  • Monitoring and load tests — 7

10.1

Prometheus — metrics

Prometheus scrapes numbers from every target every 15–30 s; promtool checks its config and rules.

promtool check config prometheus.yml
promtool check rules alerts.yml
curl -s 'http://prometheus:9090/api/v1/query?query=up' | jq '.data.result[] | [.metric.instance, .value[1]]'

10.2

node_exporter — server metrics

node_exporter gives CPU, memory, disk and network numbers of a Linux server on port 9100.

curl -s localhost:9100/metrics | grep node_filesystem_avail_bytes

10.3

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-server

10.4

Loki — logs

Loki stores logs with labels; logcli queries them from the terminal.

logcli query '{namespace="shop", app="shop"} |= "ERROR"' --since 1h
logcli query 'sum by (status) (count_over_time({app="nginx"} | json [5m]))'

10.5

OpenTelemetry Collector — one pipe for all signals

otelcol receives traces, metrics and logs (OTLP), processes them and sends them to any backend.

otelcol --config /etc/otelcol/config.yaml validate
otelcol --config /etc/otelcol/config.yaml

10.6

k6 and ab — load tests

k6 runs scripted load tests with pass/fail thresholds; ab is a quick one-URL benchmark.

k6 run -e BASE_URL=https://staging.example.com load.js
ab -k -n 2000 -c 50 https://staging.example.com/

Commands in this lesson

10.7

Alert on symptoms, not on causes

Good alerts tell you users have a problem; the dashboards then show why.

  1. Watch the 4 golden signals: latency, traffic, errors, saturation.
  2. Alert on an error rate or slow p95 latency over 5–10 minutes — not on one CPU spike.
  3. Every alert has a runbook link: what to check, how to fix.
  4. 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.

All commands in this chapter