Compose and the Datadog Agent
Datadog の調査レポート: サーバーレスの状態 レポート: サーバーレスの状態

Compose and the Datadog Agent

このページは日本語には対応しておりません。随時翻訳に取り組んでいます。翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください。

Compose is a Docker tool that simplifies building applications on Docker by allowing you to define, build and run multiple containers as a single application.

While the single container installation instructions gets the stock Datadog Agent container running, you may want to enable integrations for other containerized services that are part of your Compose application. To do this, you need to combine integration YAML files with the base Datadog Agent image to create your Datadog Agent container. Then, add your container to the Compose YAML.

Redis example

The following is an example of how you can monitor a Redis container using Compose. The file structure is:

|- docker-compose.yml
|- datadog
  |- Dockerfile
  |- conf.d
    |-redisdb.yaml

The docker-compose.yml file describes how your containers work together and sets some of the configuration details for the containers.

version: '3'
services:
  redis:
    image: redis
  datadog:
    links:
     - redis # Connect the Datadog Agent container to the Redis container
    image: datadog/agent:latest
    environment:
     - DD_API_KEY=${DD_API_KEY}
   volumes:
     - /var/run/docker.sock:/var/run/docker.sock
     - /proc/:/host/proc/:ro
     - /sys/fs/cgroup:/host/sys/fs/cgroup:ro
version: '3'
services:
  redis:
    image: redis
  datadog:
    links:
     - redis # Connect the Datadog Agent container to the Redis container
    image: datadog/agent:latest
    environment:
     - DD_API_KEY=${DD_API_KEY}
     - DD_SITE=datadoghq.eu
   volumes:
     - /var/run/docker.sock:/var/run/docker.sock
     - /proc/:/host/proc/:ro
     - /sys/fs/cgroup:/host/sys/fs/cgroup:ro

The redisdb.yaml is patterned after the redisdb.yaml.example file and tells the Datadog Agent to look for Redis on the host named redis (defined in docker-compose.yaml above) and to use the standard Redis port:

init_config:

instances:
    - host: redis
      port: 6379

Further Reading