icingaweb2-module-director icon indicating copy to clipboard operation
icingaweb2-module-director copied to clipboard

Director 1.9.0 - config rollout deploys unchanged hosts and services (because of missing fields while reading current objects)

Open axelhahn opened this issue 2 years ago • 1 comments

Expected Behavior

We POST updates to host objects and services via Director API. So far the director was able to skip unchanged objects.

Current Behavior

After upgrading Director from 1.7 --> v1.9.0 this behaviour started. With Ansible we generate a configuration for hosts and service templates and POST it to director API. So far we saw in the activity log real changes in the config only. Now each update POST of a host or a service will be marked for an update.

Servicetemplates:

  • on each servicetemplate the field "check_command" is missing in the current settings. But it exists in the database and in the Icinga2 director -> Services. It is missed in the detection for config change only. (remark I applied my patch #2487 to POST a servicetemplate config). In the activity log it looks like that: image
  • on CLI: icingacli director service show [NAME] ... the check_command is available - OK
  • on API: GET director/service?name=NAME ... the check_command is available - OK

Hosts:

  • on each host the field zone is missing. Here is the same behaviour like in the service templates - just with another field. All fields are available but in the action of detection for a config change it does not get the field zone. In the activity log the director guesses to move the host from master to a new zone.
  • on CLI: icingacli director host show [HOST] ... the zone is missing.
  • on API: GET director/host?name=HOST ... the zone is available - OK

Possible Solution

I have no solution ... but what I see so far: the database model in Director 1.7 icinga_service used a text field for a command. In v1.9 there in the table icinga_service is now an uuid for each template and the check_command was replaced by check_command_id to reference a check_command. image table row in table icinga_service The same for the table icinga_hosts I guess ... the zone was replaced by a zone_id image table row in icinga_hosts

I found that a few classes were extended to map the references zone_id into zone. Because the fields for check_command and zone are partly available and partly not - I guess the implementation for the new mapping is not complete yet.

Steps to Reproduce (for bugs)

(1) Use Director API and post existing config of a host to director/host?name=... or a service to director/service?name= and have a look to https://icinga2.example.com/icingaweb2/director/config/activities?q=#!/icingaweb2/director/config/activityies. After the config was rolled out then repeat the same POSTs to Director API - both will be rolled out once more - even if there was no change.

(2) in Icingaweb -> Icinga-Director -> Services -> Service templates (https://icinga2.example.com/icingaweb2/director/dashboard?name=services#!/icingaweb2/director/services/templates) edit a template and change a field i.e. max_attempts and save the template. The change will be rolled out a bit later and is visible in the activity log. In the diff for the change are 2 changed elements: the max_attempts and (always) the check_command. grafik

Your Environment

  • Director version (System - About): 1.9.0
  • Icinga Web 2 version and modules (System - About):2.9.5
  • Icinga 2 version (icinga2 --version): 2.13.2-1
  • Operating System and version: Centos 8 stream
  • Webserver, PHP versions: apache httpd 2.4.37; PHP 8.0.13 using PHP FPM service

axelhahn avatar Mar 08 '22 13:03 axelhahn

Hi @axelhahn, thanks for reporting this! Could you please test whether the current master (or cherry-picking 922b193) fixes your problem?

Thomas-Gelf avatar Jul 12 '22 08:07 Thomas-Gelf

No feedback, should work

Thomas-Gelf avatar Sep 21 '22 06:09 Thomas-Gelf

Shame on me - I did not see it since July :-/ I added the line n your commit in our installation ... and it worked like expected. Thanks!!

axelhahn avatar Sep 27 '22 06:09 axelhahn

No problem, thanks for letting me know!

Thomas-Gelf avatar Sep 28 '22 01:09 Thomas-Gelf