Icinga-Setup: Moving Config-Files to zones.d/master results in finding no hosts for icinga

Hi, I installed icinga2 on an Ubuntu 22. The following packages are installed:

  • icinga2 (v: 2.13.5-1)
  • icingaweb2 (v: 2.11.1, php: 8.1.2)
  • icingadb
  • icingadb-web (v: 1.0.0)
  • icingadb-redis
  • monitoring-utils

Everything went fine so far for monitoring localhost and showing the results in the web. As soon as i wanted to add an external agent i got stuck.

I executed the icinga2 node wizard and then moved the following files into /etc/icinga2/zones.d/master:

  • app.conf
  • apt.conf
  • commands.conf
  • downtimes.conf
  • groups.conf
  • hosts.conf
  • notifications.conf
  • services.conf
  • templates.conf
  • timeperiods.conf
  • users.conf

Now my webinterface does not show any host left to monitor and the command icinga2 daemon -C also shows no hosts to monitor, any hint where I did a mistake?

/etc/icinga2/icinga2.conf:

include "constants.conf"
include "zones.conf"
include <itl>
include <plugins>
include <plugins-contrib>
include <manubulon>
include <windows-plugins>
include <nscp>
include "features-enabled/*.conf"
// Disabled by the node setup CLI command on 2022-09-09 07:56:45 +0200
//include_recursive "conf.d"
// Added by the node setup CLI command on 2022-09-09 07:56:45 +0200
include "conf.d/api-users.conf"

/etc/icinga2/zones.d/master/hosts.conf:

object Host NodeName {
       import "generic-host"
        address = "127.0.0.1"
        display_name = "Icinga2"
        vars.os = "Linux"
        vars.http_vhosts["http"] = {
                http_uri = "/"
        }
        vars.http_vhosts["Icinga Web 2"] = {
                http_uri = "/icingaweb2"
                http_ssl = true
        }
        vars.disks["disk"] = {
                /* No parameters. */
        }
        vars.disks["disk /"] = {
                disk_partitions = "/"
        }
        vars.notification["mail"] = {
                groups = [ "icingaadmins" ]
        }
}

object Host "agent.fqdn.domain" {
        import "generic-host"
        address = "10.10.10.10"
        display_name = "Agent-Host"
        vars.os = "Windows"
        vars.windows.version = "Windows Server 2019"
        vars.agent_endpoint = name
}

/etc/icinga2/zones.conf:

object Endpoint "master.fqdn.domain" {
}

object Endpoint "agent.fqdn.domain" {
        host = "agent.fqdn.domain"
        log_duration = 0
}

object Zone "master" {
        endpoints = [ "master.fqdn.domain" ]
}

object Zone "agent.fqdn.domain" {
        endpoints = [ "agent.fqdn.domain" ]
        parent = "master"
}

object Zone "global-templates" {
        global = true
}

object Zone "director-global" {
        global = true
}

Output of icinga2 daemon -C:

[2022-09-09 10:20:08 +0200] information/cli: Icinga application loader (version: r2.13.5-1)
[2022-09-09 10:20:08 +0200] information/cli: Loading configuration file(s).
[2022-09-09 10:20:08 +0200] information/ConfigItem: Committing config item(s).
[2022-09-09 10:20:08 +0200] information/ApiListener: My API identity: master.fqdn.domain
[2022-09-09 10:20:08 +0200] information/ConfigItem: Instantiated 1 IcingaApplication.
[2022-09-09 10:20:08 +0200] information/ConfigItem: Instantiated 1 FileLogger.
[2022-09-09 10:20:08 +0200] information/ConfigItem: Instantiated 1 CheckerComponent.
[2022-09-09 10:20:08 +0200] information/ConfigItem: Instantiated 1 IcingaDB.
[2022-09-09 10:20:08 +0200] information/ConfigItem: Instantiated 4 Zones.
[2022-09-09 10:20:08 +0200] information/ConfigItem: Instantiated 2 Endpoints.
[2022-09-09 10:20:08 +0200] information/ConfigItem: Instantiated 2 ApiUsers.
[2022-09-09 10:20:08 +0200] information/ConfigItem: Instantiated 1 ApiListener.
[2022-09-09 10:20:08 +0200] information/ConfigItem: Instantiated 1 NotificationComponent.
[2022-09-09 10:20:08 +0200] information/ConfigItem: Instantiated 244 CheckCommands.
[2022-09-09 10:20:08 +0200] information/ScriptGlobal: Dumping variables to file '/var/cache/icinga2/icinga2.vars'
[2022-09-09 10:20:08 +0200] information/cli: Finished validating the configuration file(s).

Has anyone a hint what I did wrong? Do you need any further information?

Thanks in advance for your help!

Got it working. Problem were the permissions on the /etc/icinga2/zones.d/master directory. It was already owned by nagios:nagios, but permissions were set to 600 before, with 750 it works perfect. I leave this entry for someone else who might face the same trouble.

Permissions have to look like this:

ls -al /etc/icinga2/zones.d
drwxr-x--- 3 nagios nagios 4096 Sep  8 08:17 .
drwxr-x--- 8 nagios nagios 4096 Sep  9 11:10 ..
drwxrw---- 2 nagios nagios 4096 Sep  9 11:01 master
-rw-r--r-- 1 root   root    119 Aug 11 12:55 README