I try to get remote powershell checks running on Windows. Currently I receive the following error
[05/18/2023 11:39:22] The Icinga for Windows PowerShell instance assigned to this service is no longer present. It either crashed or was terminated by the user. Stopping service.
When I try to execute a check I receive following messages in the debug log:
[2023-05-18 11:50:06 +0200] notice/JsonRpcConnection: Received 'event::ExecuteCommand' message from identity 'host'.
[2023-05-18 11:50:06 +0200] notice/Process: Running command 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -C "try { Use-Icinga -Minimal; } catch { Write-Output 'The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details'; Write-Output 'Error:' $($_.Exception.Message)Components:`r`n$( Get-Module -ListAvailable 'icinga-powershell-*' )`r`n'Module-Path:'`r`n$($Env:PSModulePath); exit 3; }; Exit-IcingaExecutePlugin -Command 'Invoke-IcingaCheckCPU' "': PID 3816
[2023-05-18 11:50:07 +0200] notice/Process: PID 3816 ('C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -C "try { Use-Icinga -Minimal; } catch { Write-Output 'The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details'; Write-Output 'Error:' $($_.Exception.Message)Components:`r`n$( Get-Module -ListAvailable 'icinga-powershell-*' )`r`n'Module-Path:'`r`n$($Env:PSModulePath); exit 3; }; Exit-IcingaExecutePlugin -Command 'Invoke-IcingaCheckCPU' "') terminated with exit code 3
In the event log I get the following error:
[2023-05-18 11:50:06 +0200] notice/JsonRpcConnection: Received 'event::ExecuteCommand' message from identity 'host'.
[2023-05-18 11:50:06 +0200] notice/Process: Running command 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -C "try { Use-Icinga -Minimal; } catch { Write-Output 'The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details'; Write-Output 'Error:' $($_.Exception.Message)Components:`r`n$( Get-Module -ListAvailable 'icinga-powershell-*' )`r`n'Module-Path:'`r`n$($Env:PSModulePath); exit 3; }; Exit-IcingaExecutePlugin -Command 'Invoke-IcingaCheckCPU' "': PID 3816
[2023-05-18 11:50:07 +0200] notice/Process: PID 3816 ('C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -C "try { Use-Icinga -Minimal; } catch { Write-Output 'The Icinga XY PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details'; Write-Output 'Error:' $($_.Exception.Message)Components:`r`n$( Get-Module -ListAvailable 'icinga-powershell-*' )`r`n'Module-Path:'`r`n$($Env:PSModulePath); exit 3; }; Exit-IcingaExecutePlugin -Command 'Invoke-IcingaCheckCPU' "') terminated with exit code 3
According to windows service overview the service icingapowershell tries to start and then immediately terminates.
I installed Icinga agent and powershell framework according to
https://icinga.com/docs/icinga-for-windows/latest/doc/110-Installation/01-Getting-Started/
Further information:
PS C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework> Show-IcingaRegisteredServiceChecks
List of configured background service checks on this system:
=> https://icinga.com/docs/icinga-for-windows/latest/doc/110-Installation/06-Collect-Metrics-over-Time/
No background service checks configured
PS C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 1 19041 2673
PS C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework> Get-IcingaBackgroundDaemons;
Name Value
---- -----
Start-IcingaServiceCheckDaemon {}
Start-IcingaWindowsRESTApi {}
PS C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework> Get-Service icingapowershell;
Status Name DisplayName
------ ---- -----------
Stopped icingapowershell Icinga PowerShell Service
PS C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework> Test-IcingaAgent
[Passed]: Icinga Agent service is installed
[Passed]: The specified user "NT Authority\NetworkService" is allowed to run as service
[Passed]: Directory "C:\ProgramData\icinga2\etc" is accessible and writable by the Icinga Service User "NT Authority\NetworkService"
[Passed]: Directory "C:\ProgramData\icinga2\var" is accessible and writable by the Icinga Service User "NT Authority\NetworkService"
[Passed]: Directory "C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache" is accessible and writable by the Icinga Service User "NT Authority\NetworkService"
[Passed]: Directory "C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\config" is accessible and writable by the Icinga Service User "NT Authority\NetworkService"
[Passed]: Directory "C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\certificate" is accessible and writable by the Icinga Service User "NT Authority\NetworkService"
[Passed]: The Icinga Agent state file is healthy
[Passed]: Icinga Agent configuration is valid
[Passed]: Icinga Agent debug log is disabled
Any ideas how to further debug this problem?
Last entries from procmon when I try to start the powershell service: