الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

الفصل 7الاسم في الدورة: Observability

See what happens (metrics, logs, traces and alerts)

You cannot fix what you cannot see. Metrics say that something is wrong, logs say what happened, traces say where the time went, and alerts wake the right person. These 7 tools are the open-source standard stack (often called the LGTM or Prometheus/Grafana stack).

  • 7 الدروس
  • 11 الأوامر

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

$ مستخدم عادي# بصلاحية root (أو مع sudo)

المهارات في هذا الفصل

  • المراقبة — 7

7.1

Prometheus — metrics and alert rules

Prometheus scrapes /metrics endpoints, stores time series and evaluates alert rules; promtool checks configs and rules and runs PromQL.

promtool check config /etc/prometheus/prometheus.yml
promtool check rules /etc/prometheus/rules/*.yml
promtool query instant http://localhost:9090 'up == 0'
promtool test rules node-test.yml

Security checklist:

  • No login by default: TLS + basic auth (--web.config.file) or keep it internal.
  • Avoid high-cardinality labels.

الأوامر في هذا الدرس

7.2

Alertmanager — route and silence alerts

Alertmanager groups alerts, sends them to the right team (mail, Slack, Teams, PagerDuty) and holds silences; amtool controls it.

amtool check-config /etc/alertmanager/alertmanager.yml
amtool alert query severity=critical
amtool silence add instance="web1:9100" --comment "Kernel update OPS-412" --duration 1h
amtool config routes test severity=critical

الأوامر في هذا الدرس

7.3

node_exporter — Linux host metrics

node_exporter shows CPU, memory, disk, network and systemd metrics on port 9100; the textfile collector adds your own metrics (backup age).

curl -s localhost:9100/metrics | grep node_filesystem_avail_bytes
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=10.20.0.5/32 port port=9100 protocol=tcp accept'

7.4

Grafana — dashboards

Grafana shows metrics, logs and traces from many sources in dashboards and alerts; provision data sources and dashboards from Git.

grafana cli admin reset-admin-password 'N3w-Strong-Pass!'
curl -s -H "Authorization: Bearer $GRAFANA_TOKEN" http://localhost:3000/api/search | jq '.[].title'

Security checklist:

  • Change admin/admin, no sign-up, no anonymous access, SSO.
  • Secrets via $__file{} or env vars.

7.5

Loki — logs by labels

Loki stores logs cheaply and indexes only labels; search with LogQL in Grafana or with logcli.

logcli query '{namespace="shop"} |= "error"' --since=1h
logcli query '{app="api"} | json | status >= 500' --since=30m
logcli query '{namespace="shop"}' --tail

الأوامر في هذا الدرس

7.6

Fluent Bit — ship the logs

fluent-bit collects logs from files, the journal and containers, adds Kubernetes metadata, masks secrets and sends them to Loki, Elasticsearch or Azure Monitor.

fluent-bit -c /etc/fluent-bit/fluent-bit.conf --dry-run
helm install fluent-bit fluent/fluent-bit -n logging --create-namespace
curl -s http://localhost:2020/api/v1/health

Security checklist:

  • Remove tokens, passwords and personal data before logs leave the host.
  • TLS for outputs.

7.7

OpenTelemetry Collector — one pipeline for all signals

otelcol receives traces, metrics and logs (OTLP), processes them (batch, redact, sample) and exports them to any backend — vendor-neutral.

otelcol-contrib validate --config=/etc/otelcol-contrib/config.yaml
export OTEL_EXPORTER_OTLP_ENDPOINT=http://otelcol:4318
curl -s http://localhost:13133/

في العمل

Build the stack once in your home lab with helm install … kube-prometheus-stack, Loki and Grafana; then write 3 alerts (instance down, disk almost full, 5xx error rate) and one dashboard. That is a strong interview story.

كل الأوامر في هذا الفصل