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

otelcol

The OpenTelemetry Collector receives traces, metrics and logs (OTLP and more), processes them and exports them to any backend.

المستوى
خدمة DevSecOps
المجموعة
المراقبة والسجلات
يحتاج root
للتغييرات
الحزمة
otelcol-contrib
يُسمّى أيضًا
otelcol-contrib, opentelemetry-collector

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

ماذا يفعل

OpenTelemetry (CNCF) is the standard way for apps to send traces, metrics and logs. Apps use an OTel SDK or auto-instrumentation and send OTLP (gRPC 4317, HTTP 4318) to the Collector. The Collector has receivers (otlp, prometheus, filelog, hostmetrics), processors (batch, memory_limiter, attributes, filter, k8sattributes) and exporters (otlp to Tempo/Jaeger, prometheusremotewrite, loki, azuremonitor), joined in pipelines.

otelcol-contrib is the build with most components. In Kubernetes, use the OpenTelemetry Operator or the Helm chart.

طريقة الكتابة

otelcol-contrib --config=FILE
otelcol-contrib validate --config=FILE

الأجزاء الرئيسية

Config sections

receivers
Where data comes in (otlp, prometheus, filelog, hostmetrics).
processors
Change data (batch, memory_limiter, attributes, filter).
exporters
Where data goes (otlp, otlphttp, prometheusremotewrite, debug).
extensions
health_check, pprof, zpages, auth.
service.pipelines
traces / metrics / logs: receivers → processors → exporters.

الخيارات 4

الأكثر استخدامًا

Command flags

--config=FILE
Config file (can repeat; also env:, yaml: sources).
validate
Check the config and exit.
components
List built-in components.
--feature-gates=NAME
Turn on new features.

أمثلة 10

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

  1. 1A simple gateway config

    cat /etc/otelcol-contrib/config.yaml
    receivers:
      otlp:
        protocols:
          grpc: { endpoint: 0.0.0.0:4317 }
          http: { endpoint: 0.0.0.0:4318 }
    processors:
      memory_limiter: { check_interval: 1s, limit_percentage: 80, spike_limit_percentage: 20 }
      batch: {}
    exporters:
      otlp/tempo: { endpoint: tempo.monitoring.svc:4317, tls: { insecure: true } }
      prometheusremotewrite: { endpoint: http://prometheus.monitoring.svc:9090/api/v1/write }
      debug: { verbosity: basic }
    service:
      pipelines:
        traces:  { receivers: [otlp], processors: [memory_limiter, batch], exporters: [otlp/tempo] }
        metrics: { receivers: [otlp], processors: [memory_limiter, batch], exporters: [prometheusremotewrite] }
  2. 2Validate and start

    otelcol-contrib validate --config=/etc/otelcol-contrib/config.yaml
    systemctl restart otelcol-contrib
  3. 3Run in a container

    podman run -d --name otelcol -p 4317:4317 -p 4318:4318 -v ./config.yaml:/etc/otelcol-contrib/config.yaml:Z docker.io/otel/opentelemetry-collector-contrib:0.112.0
  4. 4Send a test trace with telemetrygen

    telemetrygen traces --otlp-insecure --otlp-endpoint localhost:4317 --traces 5
  5. 5Point an app at the collector

    export OTEL_SERVICE_NAME=shop-api
    export OTEL_EXPORTER_OTLP_ENDPOINT=http://otelcol:4318
    export OTEL_RESOURCE_ATTRIBUTES=deployment.environment=prod
    opentelemetry-instrument python app.py
  6. 6Collect host metrics too

    cat hostmetrics.yaml
    receivers:
      hostmetrics:
        collection_interval: 30s
        scrapers: { cpu: {}, memory: {}, filesystem: {}, network: {} }
  7. 7Remove sensitive attributes

    cat redact.yaml
    processors:
      attributes/redact:
        actions:
          - { key: http.request.header.authorization, action: delete }
          - { key: user.email, action: hash }
  8. 8Install on Kubernetes with Helm

    helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
    helm install otel open-telemetry/opentelemetry-collector -n monitoring --set mode=daemonset --set image.repository=otel/opentelemetry-collector-contrib
  9. 9Check health

    curl -s http://localhost:13133/
  10. 10List the components of your build

    otelcol-contrib components | head -40

انتبه

  • Always put memory_limiter first and batch last in the processor list.
  • Traces can carry personal data and tokens in attributes; redact them in the collector.
  • Do not expose 4317/4318 to the internet without auth (use the auth extensions or a gateway).

الملفات

/etc/otelcol-contrib/config.yaml
Configuration (RPM/DEB packages).

نصائح للحفظ

  • Agent (on each node) + gateway (central) is the common setup.

رموز الخروج

0Success.
1Error (invalid config).

الدليل الكامل

هذه الصفحة تشرح الأمر بكلمات بسيطة. الدليل الأصلي فيه كل التفاصيل.

في الطرفية: man otelcol