Skip to content
Florian Forster edited this page Nov 26, 2023 · 1 revision

The FQDNLookup configuration option is a top-level configuration option in the collectd config file. It controls how a hostname is chosen. When enabled, the hostname of the node is set to the fully qualified domain name (FQDN). This option defaults to true since Version-5.0. Ancient versions (prior to Version-4.3) did not have this option and the 4.x series defaults to false to be backwards compatible.

Operation

If the FQDNLookup option is set to true, it will first determine the host part of the FQDN using gethostname(2). This is usually a short string without any dots, for example “leeloo”.

As a second step, the daemon tries resolve the host part using getaddrinfo(3). It sets the AI_CANONNAME flag so in addition to the IP-address the “official” name of the host is returned. What this does is basically a reverse-lookup on the IP-address.

In short, the following steps are performed:

  • Short name → IP-address → FQDN

Configure lookups

One of the most common problems when using the FQDNLookup option is incorrectly configured systems with regard to their hostname. The hostname should just be the local part, i.e. the leftmost part of the FQDN.

For example, lets assume a node with the FQDN “leeloo.collectd.org”. The hostname of that node is “leeloo”. To verify this, run:

 $ uname -n
 leeloo

Using hostname(1) to check this is dangerous, because it only sets the hostname on some systems. I have seen quite some Solaris boxes named “--help” ;)

To ensure that the hostname can be resolved okay, make sure that the appropriate entry in /etc/hosts is correct. It should read:

192.168.0.2  leeloo.collectd.org  leeloo

Please note that the order of columns is important: The first column holds the address, the second column holds the “official name” (i.e. the FQDN). All further columns are aliases for the official name. One of those columns must hold the short hostname.

See also

  • hosts(5)
  • hostname(7)
Clone this wiki locally