Search code examples
amazon-web-servicesamazon-ec2sshssh-keysdatadog

Datadog SSH integration error: Server 'localhost' not found in known_hosts


With reference to Datadog document for SSH integration I am trying to use it, but getting the following error :

Datadog’s ssh_check integration is reporting: Instance #ssh_check:fbecff0ac9464f00[ERROR]: [{"message": "Server 'localhost' not found in 
known_hosts", "traceback": "Traceback (most recent call last):\n File \"/opt/datadog-agent/embedded/lib/python3.8/site-packages/datadog_checks/base/checks/base.py\", 
line 841, in run\n self.check(instance)\n File \"/opt/datadog-agent/embedded/lib/python3.8/site-packages/datadog_checks/ssh_check/ssh_check.py\",
 line 67, in check\n client.connect(\n File \"/opt/datadog-agent/embedded/lib/python3.8/site-packages/paramiko/client.py\", line 415, in connect\n self._policy.missing_host_key(\n File \"/opt/datadog-agent/embedded/lib/python3.8/site-packages/paramiko/client.py\", line 823, in missing_host_key\n raise 
SSHException(\nparamiko.ssh_exception.SSHException: Server 'localhost' not found in known_hosts\n"}]

As per my understanding of this error: Server 'localhost' not found in known_hosts, I tried ssh myusername@localhost and Permanently added localhost to the list of known hosts. I am still getting the same error. How can I fix this issue?

Note: I am trying to implement an ssh check, in Datadog for my AWS EC2 instance ie I want to alert when there is an ssh issue on my servers

Datadog screenshot


Solution

  • Found the solution. Added following line to config

    add_missing_keys: true