Datadog Agent for Docker

Basic Datadog Deployment on Docker Environments

Use the following steps to integrate Datadog agent with Docker container services.

  1. Add the following datadog service entry in the existing docker-compose.yaml:

    datadog:
        build: datadog
        container_name: datadog-agent #replace with anything specific to environment.
        links:
         - <<service>> # Add appropriate service links
        environment:
         - DD_API_KEY=temp_api_key
         - DD_CONTAINER_EXCLUDE=name:datadog-agent # OPTIONAL To exclude datadog agent logs to be sent to Kloudfuse
        volumes:
         - /var/run/docker.sock:/var/run/docker.sock
         - /proc/:/host/proc/:ro
         - /sys/fs/cgroup:/host/sys/fs/cgroup:ro
         - /var/lib/docker/containers:/var/lib/docker/containers:ro
  2. Create a directory datadog to build the datadog agent image.

  3. Create a datadog.yaml file in the datadog directory to configure the agent to send data to the Kloudfuse ingester.

    api_key: temp_api_key
    site: datadoghq.com
    ​
    dd_url: "http://<URL>/ingester" # Use http or https depending on whether HTTPS/TLS is configured on Kloudfuse
    skip_ssl_validation: true # Skip this if you do not want to skip the SSL/TLS validation
    ​
    ​
    logs_enabled: true
    logs_config:
      logs_dd_url: "URL:80" # Use port 443 if HTTPS/TLS is enabled
      use_http: true
      logs_no_ssl: true # Set to false if HTTPS/TLS is enabled
      auto_multi_line_detection: false
      use_v2_api: false
      container_collect_all: true
    ​
    apm_config:
      enabled: true
      apm_dd_url: "URL:80/ingester" # User port 443 if HTTPS/TLS is enabled
    ​
    process_config:
      process_dd_url: "http://URL/ingester" # Use http or https depending on whether HTTPS/TLS is configured on Kloudfuse
      events_dd_url: "http://URL/ingester" # Use http or https depending on whether HTTPS/TLS is configured on Kloudfuse
      container_collection:
        enabled: false
    metadata_providers:
      - name: host
        interval: 300
    ​​
    use_v2_api:
      series: true
  4. Create a Dockerfile in the datadog directory.

    FROM gcr.io/datadoghq/agent:7
    
    ADD datadog.yaml /etc/datadog-agent/datadog.yaml
  5. Add the necessary yaml files to the conf.d directory.

  6. Build the datadog agent image.

    docker-compose build
  7. Update your current deployment to use the Datadog agent container to send Metrics, Logs, and Events data to Kloudfuse.

    docker compose up -d

Adding Custom Tags

Add custom tags to the agent for all metrics, logs, and events collected by the agent. Follow these steps.

  1. Update the environment section of datadog in docker-compose.yml file to include following code.

    datadog:
        ...
        environment:
         ...
         - DD_TAG=custom_tag_name:custom_tag_value
  2. The Kloudfuse helm custom-values.yaml file must list the custom tags.

    ingester:
      config:
        hostTagIncludes:
        ...
        - custom_tag_name (1)
        ...
    1 custom_tag_name: Add all custom tag names; otherwise, the system may overwrite existing configurations.
  3. Alternatively, if you don’t plan to maintain a long list of possible custom tags, set allowAllHostTags to true. This effectively adds all extracted custom tags to the allow list.

    ingester:
      config:
        allowAllHostTags: true (1)
    1 allowAllHostTags: Adds all custom tag names to the allow list; otherwise, the system may overwrite existing configurations.