Command_endpoint not working

version r2.14.2-1
Typical master/client setup, used the “node wizard” to add my host, keepalive is ok.
This is an entry in conf.d/hosts/:


object Host "gbw-s-ssh02.luna.kuleuven.be" {
  import "generic-host"
  address = "10.112.84.78"
  vars.os = "Linux"
  vars.remote_client = name
}

This is my section in services.conf:

apply Service "procs" {
  import "generic-service"

  check_command = "procs"

  command_endpoint =  host.vars.remote_client
  assign where host.vars.os == "Linux"
}

When I run icinga2 daemon -C, I get:

[2024-07-31 07:31:14 +0000] information/cli: Icinga application loader (version: r2.14.2-1)
[2024-07-31 07:31:14 +0000] information/cli: Loading configuration file(s).
[2024-07-31 07:31:14 +0000] information/ConfigItem: Committing config item(s).
[2024-07-31 07:31:14 +0000] information/ApiListener: My API identity: gbw-s-icinga02.luna.kuleuven.be
[2024-07-31 07:31:14 +0000] critical/config: Error: Validation failed for object ‘gbw-s-ssh02.luna.kuleuven.be!procs’ of type ‘Service’; Attribute ‘command_endpoint’: Object ‘gbw-s-ssh02.luna.kuleuven.be’ of type ‘Endpoint’ does not exist.
Location: in /etc/icinga2/conf.d/services.conf: 99:3-99:45
/etc/icinga2/conf.d/services.conf(97): check_command = “procs”
/etc/icinga2/conf.d/services.conf(98):
/etc/icinga2/conf.d/services.conf(99): command_endpoint = host.vars.remote_client
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/etc/icinga2/conf.d/services.conf(101): assign where host.vars.os == “Linux”
[2024-07-31 07:31:14 +0000] critical/config: 1 error
[2024-07-31 07:31:14 +0000] critical/cli: Config validation failed. Re-run with ‘icinga2 daemon -C’ after fixing the config.

Any help or hints?

Hi @oliware,

Could it be that your two objects (endpoint and service apply rule) are in different zones that do not see each other?

I usually place all service definitions (and apply rules) in the master zone, visible by all sub-zones.

My two cents,

Jean

this is my zones.conf:


object Endpoint "gbw-s-icinga02.luna.kuleuven.be" {
}

object Zone "master" {
	endpoints = [ "gbw-s-icinga02.luna.kuleuven.be" ]
}

This is my entry in zones.d/ :

object Endpoint  "gbw-s-ssh02.luna.kuleuven.be" {
  host = "10.112.84.78"
}

object Zone "gbw-s-ssh02.luna.kuleuven.be" {
  endpoints = [ "gbw-s-ssh02.luna.kuleuven.be" ]
  parent = "master"
}

I didn’t include the zones.d directory.

Now next error:

[2024-07-31 07:55:49 +0000] information/cli: Icinga application loader (version: r2.14.2-1)
[2024-07-31 07:55:49 +0000] information/cli: Loading configuration file(s).
[2024-07-31 07:55:49 +0000] information/ConfigItem: Committing config item(s).
[2024-07-31 07:55:49 +0000] information/ApiListener: My API identity: gbw-s-icinga02.luna.kuleuven.be
[2024-07-31 07:55:49 +0000] critical/config: Error: Validation failed for object ‘gbw-s-ssh02.luna.kuleuven.be!procs’ of type ‘Service’; Attribute ‘command_endpoint’: Checkable with command endpoint requires a zone. Please check the troubleshooting documentation.
Location: in /etc/icinga2/conf.d/services.conf: 94:1-94:21
/etc/icinga2/conf.d/services.conf(92): }
/etc/icinga2/conf.d/services.conf(93):
/etc/icinga2/conf.d/services.conf(94): apply Service “procs” {
^^^^^^^^^^^^^^^^^^^^^
/etc/icinga2/conf.d/services.conf(95): import “generic-service”
/etc/icinga2/conf.d/services.conf(96):
[2024-07-31 07:55:49 +0000] critical/config: 1 error
[2024-07-31 07:55:49 +0000] critical/cli: Config validation failed. Re-run with ‘icinga2 daemon -C’ after fixing the config.

There is something wrong with the zones, but what? It is exactly the same conf files as on my other server icinga01 (version r2.10.5-1 however)

Hi,
as soon as you are using distributed monitoring setups, you have to use the zones.conf and zones.d/ directory. Normally due to a node wizard setup you are also asked, if you want to disable the conf.d directory.
So rule of thumb is:

  • Icinga single node → conf.d
  • Icinga distributed setup → zones.d
    So try to move the stuff from conf.d to zones.d/master