π Datadog Agent Debugging Checklist for Docker Containers
If your Datadog Agent is running as a Docker container but your metrics or logs are missing from the Datadog UI, follow this guide to diagnose and resolve the issue efficiently.
1οΈβ£ Verify Datadog Agent Container is Running
Run the following command to check if the Datadog Agent container is active:
docker ps | grep datadog-agent
β
Expected Output:
CONTAINER ID IMAGE COMMAND STATUS NAMES
abcdef123456 gcr.io/datadoghq/agent:7 '/bin/entrypoint.sh' Up X minutes datadog-agent
π¨ If the container is not running, restart it:
docker-compose -f /opt/datadog/docker-compose.yml up -d
2οΈβ£ Check Datadog Agent Logs
To review logs for potential issues:
docker logs --tail 50 datadog-agent
β Look for messages related to:
- API key authentication failures
- Connection refused errors
- Failure to reach Datadog servers
π¨ If errors appear, check environment variables in your docker-compose.yml
.
3οΈβ£ Verify API Key & Connectivity
Ensure the API key is correctly set inside the container:
docker exec -it datadog-agent env | grep DD_API_KEY
Then, test connectivity manually:
docker exec -it datadog-agent sh -c 'curl -v "https://api.datadoghq.com/api/v1/validate?api_key=$DD_API_KEY"'
β
Expected Response (200 OK
):
{"valid":true}
π¨ If response is 403 Forbidden
or 401 Unauthorized
, the API key is incorrect. Verify and update it in your docker-compose.yml
.
4οΈβ£ Ensure Datadog Agent Can Reach Datadog Servers
docker exec -it datadog-agent curl -v https://app.datadoghq.com
β
Expected Output: No Connection refused
or Timeout
errors.
π¨ If blocked, allow outbound traffic:
sudo ufw allow out to api.datadoghq.com
5οΈβ£ Verify Datadog Agent is Sending Data
docker exec -it datadog-agent agent status | grep -A10 "Forwarder"
β
Look for:
Transactions flushed: successfully: X, errors: 0
π¨ If errors: X
appears, the agent is not sending data. Restart it:
docker-compose -f /opt/datadog/docker-compose.yml restart datadog-agent
6οΈβ£ Manually Send a Test Metric
If the agent is running but not visible, manually send a test metric:
docker exec -it datadog-agent agent telemetry send test.metric 1
β
Check in Datadog UI β Metrics Explorer and search for test.metric
.
π Summary of Debugging Steps
Check | Command | Expected Result | |
---|---|---|---|
Container is running | `docker ps | grep datadog-agent` | Container is running |
Check logs for errors | docker logs --tail 50 datadog-agent |
No connection/auth errors | |
Verify API key | `docker exec -it datadog-agent env | grep DD_API_KEY` | Correct API key is set |
Test Datadog connectivity | docker exec -it datadog-agent sh -c 'curl -v "https://api.datadoghq.com/api/v1/validate?api_key=$DD_API_KEY"' |
No network errors | |
Check agent network reachability | docker exec -it datadog-agent curl -v https://app.datadoghq.com |
Successful connection | |
Ensure metrics are sent | `docker exec -it datadog-agent agent status | grep -A10 "Forwarder"` | No errors in transactions |
Manually send a test metric | docker exec -it datadog-agent agent telemetry send test.metric 1 |
Appears in Datadog UI |
π Follow these steps to ensure your Docker-based Datadog Agent is properly configured! Need more help? Drop a comment or reach out! π
Top comments (0)