Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ version: "3"
services:
web:
build: web
# Uncomment to enable log collection for the web container
# labels:
# com.datadoghq.ad.logs: '[{"source": "web"}]'
command: python app.py
ports:
- "5000:5000"
Expand All @@ -32,20 +35,36 @@ services:
- DATADOG_HOST=datadog # used by the web app to initialize the Datadog library
redis:
image: redis
# Uncomment to enable log collection for the redis container
# labels:
# com.datadoghq.ad.logs: '[{"source": "redis"}]'
# agent section
datadog:
build: datadog
# Uncomment to enable log collection for the agent container
# labels:
# com.datadoghq.ad.logs: '[{"source": "redis"}]'
links:
- redis # ensures that redis is a host that the container can find
- web # ensures that the web app can send metrics
environment:
- DD_API_KEY=__your_datadog_api_key_here__
- DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true
# Uncomment to enable the log collection feature
# - DD_LOGS_ENABLED=true
# - DD_LOGS_CONFIG_DOCKER_CONTAINER_USE_FILE=true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /proc/:/host/proc/:ro
- /sys/fs/cgroup:/host/sys/fs/cgroup:ro
# Uncomment to enable the log collection feature
# - /var/lib/docker/containers:/var/lib/docker/containers:ro
```

The Datadog Agent can also optionnaly collect logs from any container, if you
want to do so just uncomment the relevant lines from the `docker-compose.yml`
file.

# Configuring the Agent

Because the Agent needs to monitor redis it needs:
Expand Down Expand Up @@ -75,4 +94,4 @@ How to test this?
1. Clone this repository
1. Update your `DD_API_KEY` in `docker-compose.yml`
1. Run all containers with `docker-compose up`
1. Verify in Datadog that your container picks up the docker and redis metrics
1. Verify in Datadog that your container picks up the docker and redis metrics
2 changes: 1 addition & 1 deletion datadog/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM datadog/agent:latest
FROM gcr.io/datadoghq/agent:latest
ADD conf.d/redisdb.yaml /etc/datadog-agent/conf.d/redisdb.yaml
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ version: "3"
services:
web:
build: web
# Uncomment to enable log collection for the web container
# labels:
# com.datadoghq.ad.logs: '[{"source": "web"}]'
command: python app.py
ports:
- "5000:5000"
Expand All @@ -13,16 +16,27 @@ services:
- DATADOG_HOST=datadog # used by the web app to initialize the Datadog library
redis:
image: redis
# Uncomment to enable log collection for the redis container
# labels:
# com.datadoghq.ad.logs: '[{"source": "redis"}]'
# agent section
datadog:
build: datadog
# Uncomment to enable log collection for the agent container
# labels:
# com.datadoghq.ad.logs: '[{"source": "redis"}]'
links:
- redis # ensures that redis is a host that the container can find
- web # ensures that the web app can send metrics
environment:
- DD_API_KEY=__your_datadog_api_key_here__
- DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true
# Uncomment to enable the log collection feature
# - DD_LOGS_ENABLED=true
# - DD_LOGS_CONFIG_DOCKER_CONTAINER_USE_FILE=true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /proc/:/host/proc/:ro
- /sys/fs/cgroup:/host/sys/fs/cgroup:ro
# Uncomment to enable the log collection feature
# - /var/lib/docker/containers:/var/lib/docker/containers:ro