Datadog integration not working

Hello I am trying to integrate Home Assistant to Datadog so I can monitor multiple HA instances in Datadog. For testing I have installed a Datadog agent on a M1 Mac (version 7.32.2) in the same network as the HA instance. The Mac agent is working and shows up in the Datadog web front end.

I have now activated datadog in Home Assistant by adding the following line in the configuration.yaml:

datadog:
  host: <IP Adress of Mac who runs the datadog agent>

After restart I was supposed to see Home Assistant Events in Datadog but I don’t. I looked at the log file in Home Assistant and found the following error:

2023-07-12 12:43:27.995 ERROR (SyncWorker_19) [datadog.dogstatsd] Failed to send packet with a newly bound socket
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/datadog/dogstatsd/base.py", line 267, in _send_to_server
(self.socket or self.get_socket()).send(packet.encode(self.encoding))
OSError: [Errno 9] Bad file descriptor
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/datadog/dogstatsd/base.py", line 274, in _send_to_server
self.get_socket().send(packet.encode(self.encoding))
ConnectionRefusedError: [Errno 111] Connection refused
1 Like

Hello,

maybe Datadog integration can help

Hi @wolfmar80

I came across the same problem when setting up DataDog and HomeAssistant.
The documentation does not fully explain that you need to enable the agent to accept non local traffic from other sources.

You can open the configuration file on the agent.

sudo nano /etc/datadog-agent/datadog.yaml

You can use CTRL+W to search for the string dogstatsd_non_local_traffic.
Remove the # comment and make sure the value is set to true.

Then you can save the file using CTRL+O and exit using CTRL+X
You then need to restart the agent using.

systemctl restart datadog-agent

Once restarted, it should start ingesting the data.
You can seach it under Metric Explorer, they start with hass.