icinga-powershell-framework icon indicating copy to clipboard operation
icinga-powershell-framework copied to clipboard

Installation stuck at "Loading Powershell Framework"

Open benhartwich opened this issue 10 months ago • 6 comments

Hi,

I am using an elevated powershell and set: Set-ExecutionPolicy -ExecutionPolicy ByPass -Scope Process

and tried to install the power shell framework:

[Net.ServicePointManager]::SecurityProtocol = 'tls12, tls11';
$ProgressPreference                         = 'SilentlyContinue';
[string]$ScriptFile                         = 'C:\Users\Public\IcingaForWindows.ps1';

Invoke-WebRequest `
    -UseBasicParsing `
    -Uri             'https://packages.icinga.com/IcingaForWindows/IcingaForWindows.ps1' `
    -OutFile         $ScriptFile;

& $ScriptFile `
    -ModuleDirectory  'C:\Program Files\WindowsPowerShell\Modules\' `
    -InstallCommand   '{"IfW-DirectorSelfServiceKey":{"Values":["313483a65a4"]},"IfW-DirectorUrl":{"Values":["http://te-icinga-vm.xy.at/director/"]},"IfW-StableRepository":{"Values":["https://packages.icinga.com/IcingaForWindows/stable"]}}' `
    -IcingaRepository 'https://packages.icinga.com/IcingaForWindows/stable/ifw.repo.json'

The installation is stuck at "loading powershell framework - what could I´ve done wrong?

[Notice]: PowerShell Execution-Policies are configured to run Scripts and/or Modules.
[Notice]: Icinga PowerShell Framework is already installed. Using Framework functions for kickstarter.
[Notice]: Loading Icinga PowerShell Framework.

benhartwich avatar Feb 03 '25 06:02 benhartwich

The system shouldn't freeze at this point and can't reproduce this. What operating system are you running this on? Have you set the execution policy for the CurrentUser / LocalMachine as well?

LordHepipud avatar Feb 03 '25 11:02 LordHepipud

I have set the ExecutionPolicy to CurrentUser and there it stops at another when trying a new install on Windows 11 Pro.

[Notice]: The task "Set Process Priority" has been successfully registered at location "\Icinga\Icinga for Windows\".

I don´t know where to start - is there any kind of debug parameter for the script in order to see, what is happening exactly?

benhartwich avatar Feb 03 '25 11:02 benhartwich

What happens if you run

icinga -Shell

Basically what is called next after the message is

Use-Icinga

Maybe we can start there to check what is going on.

LordHepipud avatar Feb 03 '25 12:02 LordHepipud

It succeeded after setting the ExecutionPolicy to ByPass for the LocalMachine also and reinstalled all.

benhartwich avatar Feb 04 '25 11:02 benhartwich

We are seeing the same problem, changing the execution policy does not make it different.

In WS2016, Use-Icinga and -Shell get stuck.

It seems the framework installation gets stuck at

[Notice]: Applying pending migrations required for Icinga for Windows v1.13.0.1
[Notice]: The task "Set Process Priority" has been successfully registered at location "\Icinga\Icinga for Windows\".
[Error]: The scheduled task "Management Task" at path "\Icinga\Icinga for Windows\" could not be executed within 180 seconds and run into a timeout

Seems the below that gets stuck

powershell -WindowStyle Hidden -Command &{ & 'C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\jobs\GetWindowsService.ps1' -ServiceName 'icinga2' -TmpFilePath 'C:\Users\username\AppData\Local\Temp\2\tmp_icinga319485347.tmp' }

We have tried rebooting this machine, or uninstalling the framework module but does not seem to work.

f1ngerscr0ssed avatar Feb 19 '25 10:02 f1ngerscr0ssed

I found the root cause, underneath GetWindowsService.ps1 it will call Get-IcingaWindowsInformation.ps1 that will be used to query services (to find icinga2), in our case we had a log shipper "filebeat" that seem to make the ultimate underneath query Get-CimInstance Win32_Service super slow (or not able to return in many cases), this was hanging the execution of the scheduled task and GetWindowsService.ps1 was never finishing.

Underneath all this, the ultimate basic call that was hanging in one of the scripts above was Get-CimInstance Win32_Service

After killing the filebeat process, we were able to install the framework and the agent correctly.

f1ngerscr0ssed avatar Feb 19 '25 10:02 f1ngerscr0ssed