APM retrieves the hostname via the Java API. By running the command (this is for Linux):
which displays all FQDNs of the machine. This option enumerates all configured network addresses on all configured network interfaces, and translates them to DNS domain names. Addresses that cannot be translated (i.e. because they do not have an appropriate reverse DNS entry) are skipped. Note that different addresses may resolve to the same name, therefore the output may contain duplicate entries.
Then check the /etc/hosts file and see if they match.