Collector recipes

Copy-paste OpenTelemetry Collector configs for servers, standalone containers, Kubernetes and applications.

opentelemetrycollectorhostmetricsdocker_statskubeletstatsrecipes

How to use these

Each recipe is a complete config.yaml. Replace the Authorization value with your key, keep the otlphttp/verops exporter as-is, and run with the contrib image:

docker run -d --name verops-otel --restart unless-stopped \
  -v "$PWD/config.yaml:/etc/otelcol-contrib/config.yaml:ro" \
  otel/opentelemetry-collector-contrib:latest

A. Host metrics → Servers

Reports the host under Infrastructure → Servers. Note resourcedetection (sets host.name) and the /hostfs mounts so the container reads the real host.

receivers:
  hostmetrics:
    root_path: /hostfs
    collection_interval: 15s
    scrapers: { cpu: , memory: , load: , network: , filesystem: }
processors:
  resourcedetection:
    detectors: [env, system]
    system: { hostname_sources: [os] }
  batch: { timeout: 5s }
exporters:
  otlphttp/verops:
    endpoint: https://ingest.verops.io
    compression: gzip
    headers: { Authorization: "Bearer ta_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }
service:
  pipelines:
    metrics: { receivers: [hostmetrics], processors: [resourcedetection, batch], exporters: [otlphttp/verops] }
docker run -d --name verops-otel --restart unless-stopped \
  -v /proc:/hostfs/proc:ro -v /sys:/hostfs/sys:ro -v /:/hostfs:ro \
  -v "$PWD/config.yaml:/etc/otelcol-contrib/config.yaml:ro" \
  otel/opentelemetry-collector-contrib:latest

B. Standalone Docker containers → Containers

The docker_stats receiver sets container.name per container, so each shows under Infrastructure → Containers. Mount the Docker socket.

receivers:
  docker_stats:
    endpoint: unix:///var/run/docker.sock
    collection_interval: 15s
    metrics:
      container.cpu.utilization: { enabled: true }
      container.memory.usage.total: { enabled: true }
      container.memory.usage.limit: { enabled: true }
processors:
  resourcedetection: { detectors: [env, system] }
  batch: { timeout: 5s }
exporters:
  otlphttp/verops:
    endpoint: https://ingest.verops.io
    compression: gzip
    headers: { Authorization: "Bearer ta_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }
service:
  pipelines:
    metrics: { receivers: [docker_stats], processors: [resourcedetection, batch], exporters: [otlphttp/verops] }
docker run -d --name verops-otel --restart unless-stopped \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  -v "$PWD/config.yaml:/etc/otelcol-contrib/config.yaml:ro" \
  otel/opentelemetry-collector-contrib:latest

C. Kubernetes (DaemonSet)

Run a Collector per node with kubeletstats (per-container metrics, sets container.name + k8s.*) and hostmetrics for the node. Add k8sattributes to attach pod/deployment metadata.

receivers:
  kubeletstats:
    collection_interval: 15s
    auth_type: serviceAccount
    endpoint: https://${env:K8S_NODE_NAME}:10250
    insecure_skip_verify: true
  hostmetrics:
    root_path: /hostfs
    scrapers: { cpu: , memory: , load: , network: , filesystem: }
processors:
  k8sattributes: {}
  resourcedetection: { detectors: [env, system] }
  batch: { timeout: 5s }
exporters:
  otlphttp/verops:
    endpoint: https://ingest.verops.io
    compression: gzip
    headers: { Authorization: "Bearer ta_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }
service:
  pipelines:
    metrics: { receivers: [kubeletstats, hostmetrics], processors: [k8sattributes, resourcedetection, batch], exporters: [otlphttp/verops] }

Set K8S_NODE_NAME from spec.nodeName via the downward API in the DaemonSet.

D. Application traces & metrics

Instrument the app with an OpenTelemetry SDK and export to your Collector (or straight to VerOps). Always set service.name:

export OTEL_SERVICE_NAME=checkout-api
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318   # or https://ingest.verops.io direct