Quick Guide for Datadog Agent on Docker for Metrics
-
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 -
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 -
To collect additional metrics, enable “checks”, such as OpenMetrics checks: copy the
conf.yamlexample file into theconf.yamlin theopenmetrics.ddirectory. See Datadog’s OpenMetrics.cp /etc/datadog-agent/conf.d/openmetrics.d/conf.yaml.example /etc/datadog-agent/conf.d/openmetrics.d/conf.yaml