Moving manually created zones and endpoints to the Director

Hello,

I’m working on migrating hosts from manual configuration files to the Director. Unfortunately I’ve had some issues related to endpoints - once I’ve removed the config for the hosts, WITHOUT removing the manual endpoint and zone definitions, everything seems to work OK.

However, as soon as I remove the endpoint and zone definitions

#object Endpoint "example.ac.uk" {
#  host = "example.ac.uk"
#  log_duration = 0
#}

I get errors like the following:

[2024-01-09 15:51:54 +0000] critical/config: Error: Validation failed for object ‘example.ac.uk!check_disk basic-partitions’ of type ‘Service’; Attribute ‘command_endpoint’: Object ‘example.ac.uk’ of type ‘Endpoint’ does not exist.
Location: in /var/lib/icinga2/api/packages/director/48df68e1-eaf2-4623-9da2-411f0cb21374/zones.d/director-global/service_templates.conf: 6:5-6:32
/var/lib/icinga2/api/packages/director/48df68e1-eaf2-4623-9da2-411f0cb21374/zones.d/director-global/service_templates.conf(4): retry_interval = 1m
/var/lib/icinga2/api/packages/director/48df68e1-eaf2-4623-9da2-411f0cb21374/zones.d/director-global/service_templates.conf(5): enable_active_checks = true
/var/lib/icinga2/api/packages/director/48df68e1-eaf2-4623-9da2-411f0cb21374/zones.d/director-global/service_templates.conf(6): command_endpoint = host_name
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/var/lib/icinga2/api/packages/director/48df68e1-eaf2-4623-9da2-411f0cb21374/zones.d/director-global/service_templates.conf(7): }
/var/lib/icinga2/api/packages/director/48df68e1-eaf2-4623-9da2-411f0cb21374/zones.d/director-global/service_templates.conf(8):

This becomes a bit of a chicken-and-egg problem because I can’t reload Icinga via the Director or via the command line either - and it doesn’t seem like there’s a way to get the Director to automatically add these removed zones and endpoints.

  • Director version (System - About): 1.11.0
  • Icinga Web 2 version and modules (System - About): 2.12.1
  • Icinga 2 version (icinga2 --version): r2.14.1-1
  • Operating System and version: CentOS 7
  • Webserver, PHP versions: 7.3.33

are your hosts set to “Icinga2 Agent”=> Yes.
without this no endpoint config will be rendered.

whats the content of https://youricinga/icingaweb2/director/endpoints. Are there more endpoints than icinga master nodes/ satellites?

Yes they are, and there are 1901 endpoints in there - so pretty much all the hosts with manual configuration set up and not yet migrated to the director, plus a few more that are in the Director.

I think they have been imported by the Kickstart Wizard.

for all these hosts icinga director will not create the endpoint configs.

I would make a backup of the director database and delete them.

they are in the icinga_endpoint table

for like that many I would truncate the table and rerun the wizard or

DELETE FROM icinga_endpoint WHERE object_name not LIKE “yourmasternode”;

This query does not consider satellites and so on.

This was really helpful - thank you!