DEV Community

John  Ajera
John Ajera

Posted on

Datadog Agent Debugging Checklist

📌 Datadog Agent Debugging Checklist

If your Datadog Agent is running without errors but your host is missing from the Datadog UI, follow this guide to diagnose and resolve the issue efficiently.


1️⃣ Verify Datadog Agent Status

Run the following command to check if the agent is active:

sudo systemctl status datadog-agent
Enter fullscreen mode Exit fullscreen mode

Expected Output:

● datadog-agent.service - Datadog Agent
   Loaded: loaded (/lib/systemd/system/datadog-agent.service; enabled; vendor preset: enabled)
   Active: active (running) since ...
Enter fullscreen mode Exit fullscreen mode

🚨 If inactive or failed, restart the agent:

sudo systemctl restart datadog-agent
Enter fullscreen mode Exit fullscreen mode

2️⃣ Check Agent Logs for Errors

To review logs for potential issues:

sudo journalctl -u datadog-agent --no-pager --lines=50
Enter fullscreen mode Exit fullscreen mode

Look for messages related to:

  • API key authentication failures
  • Connection refused errors
  • Failure to reach Datadog servers

3️⃣ Verify API Key & Connectivity

Ensure the API key is correctly set:

sudo grep -oP '(?<=api_key: ).*' /etc/datadog-agent/datadog.yaml
Enter fullscreen mode Exit fullscreen mode

Then, test connectivity manually:

sudo curl -v "https://api.datadoghq.com/api/v1/validate?api_key=$(sudo grep -oP '(?<=api_key: ).*' /etc/datadog-agent/datadog.yaml)"
Enter fullscreen mode Exit fullscreen mode

Expected Response (200 OK):

{"valid":true}
Enter fullscreen mode Exit fullscreen mode

🚨 If response is 403 Forbidden or 401 Unauthorized, the API key is incorrect. Verify and update it in /etc/datadog-agent/datadog.yaml.


4️⃣ Check Hostname in Datadog

sudo datadog-agent hostname
Enter fullscreen mode Exit fullscreen mode

Ensure this matches the expected hostname in Datadog UI.

🚨 If incorrect, manually set it in /etc/datadog-agent/datadog.yaml:

hostname: my-hostname
Enter fullscreen mode Exit fullscreen mode

Restart the agent:

sudo systemctl restart datadog-agent
Enter fullscreen mode Exit fullscreen mode

5️⃣ Test Network Connectivity Manually

Instead of datadog-agent check connectivity, manually test connectivity:

curl -v https://app.datadoghq.com
curl -v https://api.datadoghq.com
Enter fullscreen mode Exit fullscreen mode

Expected Output: No Connection refused or Timeout errors.

🚨 If blocked, allow outbound traffic:

sudo ufw allow out to api.datadoghq.com
Enter fullscreen mode Exit fullscreen mode

6️⃣ Verify Datadog Agent is Sending Data

sudo datadog-agent status | grep -A10 "Forwarder"
Enter fullscreen mode Exit fullscreen mode

Look for:

Transactions flushed: successfully: X, errors: 0
Enter fullscreen mode Exit fullscreen mode

🚨 If errors: X appears, the agent is not sending data. Restart it:

sudo systemctl restart datadog-agent
Enter fullscreen mode Exit fullscreen mode

7️⃣ Manually Send a Test Metric

If the agent is running but not visible, manually send a test metric:

sudo datadog-agent telemetry send test.metric 1
Enter fullscreen mode Exit fullscreen mode

Check in Datadog UI → Metrics Explorer and search for test.metric.


📌 Summary of Debugging Steps

Check Command Expected Result
Agent is running sudo systemctl status datadog-agent Active: running
Check logs for errors sudo journalctl -u datadog-agent --no-pager --lines=50 No connection/auth errors
Verify API key sudo grep -oP '(?<=api_key: ).*' /etc/datadog-agent/datadog.yaml Matches correct API key
Test Datadog connectivity curl -v https://api.datadoghq.com No network errors
Check hostname sudo datadog-agent hostname Matches expected hostname
Check network reachability ping api.datadoghq.com Successful ping
Ensure metrics are sent `sudo datadog-agent status grep -A10 "Forwarder"` No errors in transactions
Manually send a test metric sudo datadog-agent telemetry send test.metric 1 Appears in Datadog UI

🚀 Follow these steps to ensure your non-containerized host appears in the Datadog UI! Need more help? Drop a comment or reach out! 🚀

Top comments (0)