Please help: values for agent and master are the same

I’ve setup icinga2 and tried to add an agent. I have followed the documentation, but in the icinga2 dashboard the services are all OK even if they’re NOT OK. I’ve figured out, that the dashboard the value for the agent-01 and the master are the same, for example the apt-check and free space
For example:
The Dashboard says for agent-01:

APT OK: 0 packages available for upgrade (0 critical updates).

If I run /usr/lib/nagios/plugins/check_apt -v on agent-01, it show’s:

APT CRITICAL: 30 packages available for upgrade (1 critical updates). |available_upgrades=30;;;0 critical_updates=1;;;0

The Dashboard says for agent-01:

DISK OK - free space: / 135973MiB (96% inode=99%);

and for icinga2.my.domain:

DISK OK - free space: / 135973MiB (96% inode=99%);

But executed directly on the agent-01:

DISK OK - free space: / 126471MiB (66% inode=98%);| /=65911390208B;167384606310;188307682099;0;209230757888

On the master-node (icinga2.my.domain) I did following:

icinga2 node wizard
**Welcome to the Icinga 2 Setup Wizard!**

**We will guide you through all required configuration details.**

**Please specify if this is an agent/satellite setup ('n' installs a master setup)** [Y/n]: n

**Starting the Master setup routine...**

**Please specify the common name** (CN) [icinga2.my.domain]:

**Reconfiguring Icinga...**

Checking for existing certificates for common name 'icinga2.my.domain'...

Certificate '/var/lib/icinga2/certs//icinga2.my.domain.crt' for CN 'icinga2.my.domain' already existing. Skipping certificate generation.

**Generating master configuration for Icinga 2.**

'api' feature already enabled.

Master zone name [master]: master

Default global zones: global-templates director-global

Do you want to specify additional global zones? [y/N]:

**Please specify the API bind host/port** (optional)**:**

**Bind Host** []:

**Bind Port** []:

Do you want to disable the inclusion of the conf.d directory [Y/n]: n

**Checking if the api-users.conf file exists...**

**Done.**

on the agent-01 I did:

icinga2 node wizard
**Welcome to the Icinga 2 Setup Wizard!**

**We will guide you through all required configuration details.**

**Please specify if this is an agent/satellite setup ('n' installs a master setup)** [Y/n]: Y

Starting the Agent/Satellite setup routine...

**Please specify the common name (CN)** [agent-01.my.domain]:

**Please specify the parent endpoint(s) (master or satellite) where this node should connect to:**

**Master/Satellite Common Name** (CN from your master/satellite node): icinga2.my.domain

Do you want to establish a connection to the parent node **from this node?** [Y/n]: Y

**Please specify the master/satellite connection information:**

**Master/Satellite endpoint host** (IP address or FQDN): icinga2.my.domain

**Master/Satellite endpoint port** [5665]: 5665

**Add more master/satellite endpoints?** [y/N]: N

**Parent certificate information:**

Version: 3

Subject: CN = icinga2.my.domain

Issuer: CN = Icinga CA

Valid From: Mar 24 12:29:30 2025 GMT

Valid Until: Apr 25 12:29:30 2026 GMT

Serial: e0:a2:f3:af:2a:ad:ce:c3:bf:38:23:ed:e2:b8:95:83:66:10:3a:82

Signature Algorithm: sha256WithRSAEncryption

Subject Alt Names: icinga2.my.domain

Fingerprint: 64 D9 12 42 A7 AD 26 1E 77 0E C6 66 79 27 CD 0C 64 0B 37 B2 A9 57 09 0E 88 57 5F 0F D3 30 30 D0

**Is this information correct?** [y/N]: Y

**Please specify the request ticket generated on your Icinga 2 master** (optional)**.**

(Hint: # icinga2 pki ticket --cn 'agent-01.my.domain'): 43d24a789b540d76077e8e7b7f9ce34c14df13db

**Please specify the API bind host/port** (optional)**:**

**Bind Host** []:

**Bind Port** []:

**Accept config from parent node?** [y/N]: Y

**Accept commands from parent node?** [y/N]: Y

**Reconfiguring Icinga...**

Disabling feature **notification**. Make sure to restart Icinga 2 for these changes to take effect.

Enabling feature **api**. Make sure to restart Icinga 2 for these changes to take effect.

Local zone name [agent-01.my.domain]:

Parent zone name [master]: master

Default global zones: global-templates director-global

Do you want to specify additional global zones? [y/N]:

Do you want to disable the inclusion of the conf.d directory [Y/n]: Y

**Disabling the inclusion of the conf.d directory...**

**Done.**

**Now restart your Icinga 2 daemon to finish the installation!**

All Services are restarted. I’ve tried several things know and I’m new to icinga2 and can’t figure out how to debug (chatGPT also did not help ..). I’ve tried purging the config on the agent-01 and reinstalling. Rerun the setup wizard on the node. Tried telnet 5665 (It’s working).

My Zone file looks like this:

cat /etc/icinga2/zones.conf
/*
 * Zone configuration for distributed Icinga 2 setup.
 */

object Endpoint "icinga2.my.domain" {
  host = "icinga2.my.domain"
}

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


object Endpoint "agent-01" {
  host = "agent-01"
}

object Zone "agent-01" {
  endpoints = [ "agent-01" ]
}

/* Global templates and sync for Icinga Director */
object Zone "global-templates" {
  global = true
}

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

my object host looks like this

cat /etc/icinga2/conf.d/my_hosts.conf
object Host "agent-01" {
  import "generic-host"
  address = "build-06.apus.work"
  check_command = "hostalive" 
  vars.os = "Linux"
  vars.apt_check = true
  vars.load_check = true
}

you service config most likely lacks the field command_endpoint

for services that run on agents it is:

command_endpoint = NodeName`

don’t forget to create endpoints for agents as well

1 Like

You’re totally right. Thank you! :grinning_face:
I followed this: Distributed Monitoring - Icinga 2

Deleted the conf.f/my_hosts.conf and conf.d/my_services.conf. Edited zones.conf like in the documentation. Created zones.d/master and moved services.conf and hosts.conf there.
Added

  // Execute the check on the remote command endpoint
  command_endpoint = host.vars.agent_endpoint

  // Assign the service onto an agent
  assign where host.vars.agent_endpoint

to the remote services.conf and added

vars.agent_endpoint = name

to the hosts.conf

Now it’s working! :slight_smile:

1 Like