Windows Agent - Last Zone Sync failed

Hello, I have installed a Windows agent on foot. The connection has worked so far and the host is UP. However, something is not working with the synchronisation. In addition, Powershell checks are not found. The logs log the following. Can anyone help me?

image

[2022-03-07 17:10:37 +0100] information/WorkQueue: #4 (ApiListener, RelayQueue) items: 0, rate:  0/s (0/min 0/5min 0/15min);
[2022-03-07 17:10:37 +0100] information/WorkQueue: #5 (ApiListener, SyncQueue) items: 0, rate:  0/s (0/min 0/5min 0/15min);
[2022-03-07 17:11:07 +0100] information/RemoteCheckQueue: items: 0, rate: 0/s (6/min 30/5min 90/15min);
[2022-03-07 17:11:17 +0100] information/RemoteCheckQueue: items: 0, rate: 0/s (6/min 30/5min 90/15min);
[2022-03-07 17:11:47 +0100] information/RemoteCheckQueue: items: 0, rate: 0/s (6/min 30/5min 90/15min);
[2022-03-07 17:12:27 +0100] information/RemoteCheckQueue: items: 0, rate: 0/s (6/min 30/5min 90/15min);
[2022-03-07 17:13:27 +0100] information/RemoteCheckQueue: items: 0, rate: 0/s (6/min 30/5min 90/15min);
[2022-03-07 17:14:17 +0100] information/RemoteCheckQueue: items: 0, rate: 0/s (6/min 30/5min 90/15min);

The failed sync lands in the API director which is on Windows in C:\ProgramData\ICINGA2\var\lib\icinga2\api\zones-stage and there should be a startup.log containing the error.

[2022-03-04 07:59:11 +0100] critical/config: Error: Error while evaluating expression: Tried to access undefined script variable 'CustomPluginDir'
Location: in C:/ProgramData/icinga2/var/lib/icinga2/api/zones-stage/director-global/director/commands.conf: 1323:17-1323:31
C:/ProgramData/icinga2/var/lib/icinga2/api/zones-stage/director-global/director/commands.conf(1321): object CheckCommand "dell-warranty-linux" {
C:/ProgramData/icinga2/var/lib/icinga2/api/zones-stage/director-global/director/commands.conf(1322):     import "plugin-check-command"
C:/ProgramData/icinga2/var/lib/icinga2/api/zones-stage/director-global/director/commands.conf(1323):     command = [ CustomPluginDir + "/check_dell_warranty.ps1" ]
                                                                                                                     ^^^^^^^^^^^^^^^
C:/ProgramData/icinga2/var/lib/icinga2/api/zones-stage/director-global/director/commands.conf(1324):     arguments += {
C:/ProgramData/icinga2/var/lib/icinga2/api/zones-stage/director-global/director/commands.conf(1325):         "-apikey" = "API-KEY"

[2022-03-04 07:59:11 +0100] critical/config: 18 errors
[2022-03-04 07:59:11 +0100] critical/cli: Config validation failed. Re-run with 'icinga2 daemon -C' after fixing the config.

I get the following error. I am wondering what these commands have to do with my windows agent. Can you help me further?

I was able to find the following information in the daemon check on the agent host

You are syncing all your global objects to your agents as you have the global zone “director-global” in your agents configuration which is default but bad design and something I would not recommend!

Thank you for your reply. Do you have any documentation or suggestions on how best to design this?

I did the installation on foot, i.e. installed the agent, entered the csr, specified the master ip, accepted commands and updates and installed the agent.

Our icinga2 infrastructure is very large and as you can see I am a newcomer :smiley:

Do you have ‘accept_config = true’ in your api.conf file on your Windows agent? Do you want all your CheckCommand sync to your Windows agents? The error message is probably because the ‘CustomPluginDir’ constant is missing on your Windows agent.

Alex

Unfortunately there is no documentation about this, but to make it short:

  • The zone “director-global” will contain all global objects which should only be available on master and satellite.
  • The agents only need specific check commands, so managing them in a separate global zone makes sense. I use “linux-agents” and “windows-agents” and in the Director select this zone for check commands I wish to sync to the corresponding agents.

And for the constant which is showing the problem: Constants will not get synced as they are in local configuration, so better avoid them or use some kind of configuration management to ensure them being in sync.

Thank you for your detailed explanation, I think I understand what you mean. I have now created the zone windows-templates in the Director. The Global Zone is defined under Director Settings. How do I have to adjust the configuration at master or agent level so that I now get the windows templates configured :slight_smile:

Thanks for your help!