User Tools

Site Tools


devops:monitoring:datadog:canonical_hostnames

How does Datadog determine the Agent hostname?

Potential host names

The Datadog Agent collects potential host names from many different sources. Run the Agent’s status subcommand to see all names the Agent is detecting.

Hostnames

hostname: my.special.hostname
agent-hostname: my.special.hostname
ec2-hostname: ip-192-0-0-1.internal
instance-id: i-deadbeef
socket-hostname: myhost
socket-fqdn: myhost.mydomain

From these names, a canonical name is chosen for the host. The Agent uses this name to identify itself to Datadog. The other names are submitted as well, but only as candidates for aliasing.

The canonical hostname is chosen according to the following rules. The first match is selected.

  agent-hostname: A hostname explicitly set in the Agent configuration file if it does not start with ip- or domu.
  hostname (hostname -f on Linux): If the DNS hostname is not an EC2 default, for example: ip-192-0-0-1.
  instance-id: If the Agent can reach the EC2 metadata endpoint from the host.
  hostname: Fall back on the DNS hostname even if it is an EC2 default.

If the name is recognized as a common non-unique name (for example, localhost.localdomain), the current rule fails and passes through to the next.

See Hostname detection logic for details on how the Agent determines the hostname.

devops/monitoring/datadog/canonical_hostnames.txt · Last modified: 2025/02/14 10:26 by 85.219.17.206