can you register the host using this form?
and please do it from the machine you want to register.
you can delete the host afterwards…
http://192.168.10.180/director/self-service/register-host
If I add “Icingaweb2” to the url you provided: http://192.168.10.180/icingaweb2/director/self-service/register-host
I can register the host fine actually:
sorry forgot about that. (“icingaweb2”).
akellar
(akellar)
December 5, 2023, 10:33pm
24
Seems this may be a bug. I’m running into the same issue. Did you resolve this?
It still persists if I try to autoinstall everything with the script. However, if I change the script and remove the install commands and insert a skip wizard:
& $ScriptFile `
-ModuleDirectory 'C:\Program Files\WindowsPowerShell\Modules\' `
-SkipWizard;
and afterwards manually use the IMC (typing “icinga;” in PS) to set it up, everything works fine for me so far! In the IMC I use “connect from this PC” instead of the “Director Self Service API”.
@Johannes @akellar
What are the settings in the “Icinga Agent and zone settings” section of your hosttemplates?
Hey @moreamazingnick
I have this setting currently. Am I lacking something?
change it to establish connection no…
The error persist with that change, when trying to automate the whole installation:
did you remove the host from icinga director before trying again?
I did, yes. And deployed changes of course.
akellar
(akellar)
December 8, 2023, 2:17pm
32
edit: php file located in /usr/share/icingaweb2/modules/director/application/controllers
@Johannes @moreamazingnick found this issue on their github. Implementing the fix PHP fixed my issue without having to make any changes to the script from the host template in the director.
opened 10:06AM - 30 Oct 23 UTC
## Expected Behavior
Self service should work
## Current Behavior
Icinga Fo… r Windows fails using the Self Service API.
## Possible Solution
This code Block produces deprecated output and prevents parsing of the json.
https://github.com/Icinga/icingaweb2-module-director/blob/aa31b37fd184228d3397c512ae8fc175f2d82d39/application/controllers/SelfServiceController.php#L403-L411
```
<b>Deprecated</b>: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/usr/share/icingaweb2/modules/director/application/controllers/SelfServiceController.php</b> on line <b>407</b><br />\n
```
I fixed it in my installation with checking if the $value is null but my php knowledge is not the best so i do not know if there is a better way.
```php
protected function addStringSettingsToParams(Settings $settings, array $keys, array &$params)
{
foreach ($keys as $key) {
$value = $settings->get("self-service/$key");
if ($value != null) {
if (strlen($value)) {
$params[$key] = $value;
}
}
}
}
```
## Steps to Reproduce (for bugs)
Install icinga director on Debian 12 bookworm with php 8.2.7 and try to add a host using the self service api.
Using wireshark the response sent to icinga for windows is the following
```
<br />
<b>Deprecated</b>: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/usr/share/icingaweb2/modules/director/application/controllers/SelfServiceController.php</b> on line <b>407</b><br />
<br />
<b>Deprecated</b>: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in <b>/usr/share/icingaweb2/modules/director/application/controllers/SelfServiceController.php</b> on line <b>407</b><br />
{
"fetch_agent_name": false,
"fetch_agent_fqdn": true,
"transform_hostname": "1",
"flush_api_directory": true,
"resolve_parent_host": "0",
"install_framework_service": "0",
"install_framework_plugins": "0",
"director_host_object": "{\"address\":\"&ipaddress&\",\"display_name\":\"&hostname.lowerCase&\"}",
"download_url": "https://packages.icinga.com/windows/",
"agent_version": "2.14.0",
"allow_updates": true,
"agent_listen_port": 5665,
"install_nsclient": true
}
```
## Your Environment
* Director version (System - About): 1.11.0
* Icinga Web 2 version and modules (System - About): 2.12.0
Loaded Libraries
icinga/icinga-php-library 0.13.0
icinga/icinga-php-thirdparty 0.12.0
Loaded Modules
director 1.11.0
doc 2.12.0
icingadb 1.1.0
incubator 0.20.0
translation 2.12.0
* Icinga 2 version (`icinga2 --version`): r2.14.0-1
* Operating System and version:
System information:
Platform: Debian GNU/Linux
Platform version: 12 (bookworm)
Kernel: Linux
Kernel version: 6.1.0-13-amd64
Architecture: x86_64
* Webserver, PHP versions: PHP 8.2.7 (cli) (built: Jun 9 2023 19:37:27) (NTS)
2 Likes
@akellar That did the trick! Thanks so much
HExSM
January 12, 2024, 3:46pm
34
I have the same issue. I tried all suggestions from this thread, but it’s still not working.
This is working btw.
Edit:
If I use the deprecated Icinga 2 Agent from https://github.com/Icinga/icinga2-powershell-module it’s working fine. That’s the Agent I have actually running on my Windows servers.