Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

Hoofdstuk 10Naam in de cursus: 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 Lessen
  • 10 Commando's

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

$ als gewone gebruiker# als root (of met sudo)

Vaardigheden in dit hoofdstuk

  • Monitoring en loadtests — 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/

Commando's in deze les

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.

Onthoud

An alert nobody acts on is noise. Delete it or fix it.

Alle commando's in dit hoofdstuk