Quick Guide for Datadog Agent on Docker for Metrics

  1. Use the official Datadog Agent image with Docker’s environment variables.

    docker run -d --name datadog-agent -e DD_API_KEY=kloudfuse -e DD_SITE=https://<kf-domain-name>/ingester -e DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true -e DD_LOGS_ENABLED=true -e DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true -e DD_APM_ENABLED=true -e DD_DD_URL=https://<kf-domain-name>/ingester --volume /var/run/docker.sock:/var/run/docker.sock:ro --volume /proc:/host/proc:ro --volume /sys:/host/sys:ro --volume /host:/host:ro --name datadog-agent datadog/agent:latest
  2. Expose Docker container metrics through its configuration; this is enabled by default when you mount the Docker socket.

    When running a service like Nginx in a container, ensure that the service emits metrics.

    docker run -d --name nginx -e "DD_AGENT_HOST=datadog-agent" -e "DD_DOGSTATSD_PORT=8125" nginx
  3. To collect additional metrics, enable “checks”, such as OpenMetrics checks: copy the conf.yaml example file into the conf.yaml in the openmetrics.d directory. See Datadog’s OpenMetrics.

    cp /etc/datadog-agent/conf.d/openmetrics.d/conf.yaml.example /etc/datadog-agent/conf.d/openmetrics.d/conf.yaml