هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
$ مستخدم عادي# بصلاحية root (أو مع sudo)
المهارات في هذا الفصل
- المراقبة — 7
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.ymlSecurity checklist:
- No login by default: TLS + basic auth (
--web.config.file) or keep it internal. - Avoid high-cardinality labels.
Alertmanager — route and silence alerts
Alertmanager groups alerts, sends them to the right team (mail, Slack, Teams, PagerDuty) and holds silences; amtool controls it.
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'Grafana — dashboards
Grafana shows metrics, logs and traces from many sources in dashboards and alerts; provision data sources and dashboards from Git.
Loki — logs by labels
Loki stores logs cheaply and indexes only labels; search with LogQL in Grafana or with logcli.
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/healthSecurity checklist:
- Remove tokens, passwords and personal data before logs leave the host.
- TLS for outputs.
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.