Checks executed on clients via agent do not appear on the master in icingaweb2

Hi. I have a master and a zone “myzone” with two clients A and B. Their configs are in zones.d/myzone/A.conf and zones.d/myzone/A.conf? Both clients define vars.disk["disk"] and use the standard service definition that can be found in conf.d/services.conf. So, this is very basic. Here are the host objects:

object Host "A" {
  import "generic-host"

  address = "a.b.c.d"
  zone = "myzone"

  vars.agent_endpoint = name
  vars.client_endpoint = name
  vars.os = "Linux"

  vars.disks["disk"] = {
  }
}

For host B, it looks similar with the name and address adjusted. The service definition is very basic:

apply Service for (disk => config in host.vars.disks) {
  import "generic-service"

  check_command = "disk"

  vars += config

  assign where host.name == NodeName
}

Both clients are behind a NAT-ted router. Therefore, the master cannot contact them directly. Instead, they connect to the master and are configured to accept configuration updates and commands. Here the zones.conf on the master:

object Endpoint "master.fqdn" {
}

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

object Endpoint "A" {}
object Endpoint "B" {}

object Zone "myzone" {
  endpoints = [ "A", "B" ]
  parent = "master"
}

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

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

and on the client A (similar for B):

object Endpoint "master.fqdn" {
        host = "master.fqdn"
        port = "5665"
}

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

object Endpoint "A" {}

object Zone "myzone" {
        endpoints = [ "A" ]
        parent = "master"
}

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

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

The service and template definitions are synced via global-templates, the host files via the zone. That seems to work quite nicely. I can see the files being synced onto the clients in the logs. And icinga doesn’t report any issues. As both A and B are in the same zone, they each get both host object conf files. Thus, I need the assign where host.name == NodeName (as in reality they have different partitions, IPs, services, domains, etc.). I can also see that the checks are executed on the client. But the results are not shown in icingaweb2 under each host. Why? What do I need to change?

I am not using Director.

I have found where I was wrong. It appears that I don’t have to sync the host definitions into the target zone. I only have a master and multiple agents. No satellites. The host object definitions can stay on master in zones.d/master/. Therefore, the check on NodeName in the services can be removed and replaced accordingly to the linked part of the documentation. And then the agents will still be instructed to run the correct tests for each host and report back the results. It is working now.

1 Like