Troubleshooting duplicated hosts with vSphere

Duplicated hosts issue context

The vSphere integration is configured to crawl into the different resources of a vCenter, such as VMs or ESXi. The integration flags the VMs and ESXi as separate hosts, and they appear in your Infrastructure List as <vsphere-hostname>.
Inside a vCenter, a guest VM can run an Agent. This Agent submits metrics and attaches <guest-hostname> metadata to them. A host appears in the Infrastructure List as <guest-hostname>. Depending on the vSphere integration configuration and the guest Agent configuration, <vsphere-hostname> and <guest-hostname> can be different. For example, <vsphere-hostname> can be a Fully Qualified Domain Name (FQDN) and <guest-hostname> a Short Name. In this case, a single VM can appear twice in the Infrastructure List.

Workaround

  • In the vSphere integration configuration file, set use_guest_hostname: true for the vSphere integration to use the guest hostname instead of the VM name given by the vCenter.
  • If the previous step does not resolve the issue, change the value of hostname_fqdn in the guest VM Agent configuration datadog.yaml.
  • If the previous steps do not resolve the issue, manually set a host alias between vsphere-hostname and guest-hostname.

Note: The old host in the Infrastructure List takes time before disappearing.

PREVIEWING: safchain/fix-custom-agent