Infrastructure not finding the correct hostname

I have a VM I use as a database, and it has a unique hostname:

$ hostname
db-01
$ hostnamectl status
   Static hostname: db-01
         Icon name: computer-vm
           Chassis: vm
    Virtualization: qemu
  Operating System: Ubuntu 16.04.2 LTS
            Kernel: Linux 4.9.15-x86_64-linode81
      Architecture: x86-64

But when new-relic infrastructure starts it says that the hostname is “localhost”. Why is that?

Nov 13 16:12:17 db-01 systemd[1]: Started New Relic Infrastructure Agent.
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="using default collector URL: https://infra-api.newrelic.com"
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Using default output directory: /var/db/newrelic-infra"
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Payload Compression Level" level=6
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Repo compaction is enabled"
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Metrics System Sample Rate" rate=5
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Metrics Storage Sample Rate" rate=5
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Metrics Network Sample Rate" rate=5
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Metrics Process Sample Rate" rate=10
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Configuration file monitoring is disabled"
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Using Network Interface Filter Set" filter=index-1 interface=tun
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Using Network Interface Filter Set" filter=index-1 interface=tap
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Using Network Interface Filter Set" filter=prefix interface=dummy
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Using Network Interface Filter Set" filter=prefix interface=lo
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Using Network Interface Filter Set" filter=prefix interface=vmnet
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Using Network Interface Filter Set" filter=prefix interface=sit
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Using Network Interface Filter Set" filter=prefix interface=tun
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Using Network Interface Filter Set" filter=prefix interface=tap
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Using Network Interface Filter Set" filter=prefix interface=veth
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=info msg="New Relic Infrastructure Agent version 1.0.804 Creating Service (1.280276ms)"
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="New Relic Infrastructure Agent version 1.0.804 Starting Service (1.305075ms)"
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=debug msg="Agent service manager START requested. (1.319948ms)"
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=info msg="Agent service manager started successfully. (1.334464ms)" service=newrelic-infra
Nov 13 16:12:17 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:17Z" level=info msg="New Relic Infrastructure Agent version 1.0.804 Initializing (3.499855ms)"
Nov 13 16:12:19 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:19Z" level=debug msg="Error detecting AWS" error="Unable to fetch AWS metadata: Get http://169.254.169.254/2009-04-04/meta-data/instance-id: dial tcp 169.254.169.254:80: i/o timeout"
Nov 13 16:12:21 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:21Z" level=debug msg="Error detecting Azure" error="Unable to fetch Azure metadata: Get http://169.254.169.254/metadata/instance?api-version=2017-04-02: dial tcp 169.254.169.254:80: i/o timeout"
Nov 13 16:12:21 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:21Z" level=debug msg="Couldn't detect any known cloud, using no cloud type"
Nov 13 16:12:21 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:21Z" level=warning msg="Localhost is not a good identifier"
Nov 13 16:12:21 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:21Z" level=debug msg="Updating identity" new=localhost old=
Nov 13 16:12:21 db-01 newrelic-infra[7915]: time="2017-11-13T16:12:21Z" level=debug msg="Bootstrap Entity Key" id=localhost

Hi @edufelipe, one of the differences between Servers and Infrastructure is that Servers used the host’s hostname, while Infrastructure actually looks at the Fully Qualified Domain Name (FQDN) of a host, and uses that as the hostname. You can have a unique hostname set up, but if your FQDN is still set to localhost, it will cause the NRIA to fail. I think that might be the issue here.

Here is a post with more information about that, and how to troubleshoot:

Let me know if that doesn’t fix the problem!

1 Like