Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Since JEA activation most of the checks return no plugin output or perfdata in IcingaWeb2 #413

Closed
K0nne opened this issue Dec 9, 2021 · 3 comments
Assignees
Labels
Bug There is an issue present
Milestone

Comments

@K0nne
Copy link

K0nne commented Dec 9, 2021

Hello,

today I tested with JEA. After the successfull activation most of the checks return no plugin output and perfdata. I'm not sure what went wrong.

Module Versions

Framework: 1.7.1
Plugins: 1.7.0
HyperV: 1.0.0
Cluster: 1.0.0

Command used:

Install-IcingaSecurity -IcingaUser 'IcingaMonitoring'

Output:

PS C:\WINDOWS\system32> Install-IcingaSecurity -IcingaUser 'IcingaMonitoring'
[Notice]: Installing user "IcingaMonitoring"
[Notice]: User was successfully created.
[Notice]: Service User ".\IcingaMonitoring" for service "icinga2" successfully updated
[Passed]: Directory "C:\ProgramData\icinga2\etc" is accessible and writable by the Icinga Service User "IcingaMonitoring"
[Passed]: Directory "C:\ProgramData\icinga2\var" is accessible and writable by the Icinga Service User "IcingaMonitoring"
[Passed]: Directory "C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache" is accessible and writable by the Icinga Service User "IcingaMonitoring"
[Passed]: Directory "C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\config" is accessible and writable by the Icinga Service User "IcingaMonitoring"
[Notice]: Restarting service "icinga2"
[Warning]: The service "icingapowershell" is not installed
[Warning]: The service "icingapowershell" is not installed
[Notice]: User "IcingaMonitoring" including permissions was successfully installed on this host
[Notice]: Writing Icinga for Windows environment information as JEA profile
[Error]: Unable to include module "icinga-powershell-hyperv" into JEA profile. The file "C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-hyperv\provider\vcomputer\Get-IcingaVirtualComputerInfo.psm1" is using one or more [ScriptBlock] variables which are forb
idden in JEA context.
[Error]: Unable to include module "icinga-powershell-hyperv_old" into JEA profile. The file "C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-hyperv_old\provider\vcomputer\Get-IcingaVirtualComputerInfo.psm1" is using one or more [ScriptBlock] variables which
are forbidden in JEA context.
[Warning]: The module "icinga-powershell-plugins" is using "Add-Type" definitions for file "C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaDiskAttributes.psm1". Ensure you validate the code before trusting this publisher.
[Error]: Unable to include module "icinga-powershell-plugins" into JEA profile. The file "C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\disks\Get-IcingaPartitionSpace.psm1" is using one or more [ScriptBlock] variables which are forbidden i
n JEA context.
[Notice]: Registering Icinga for Windows JEA profile
[Notice]: JEA Profile "IcingaForWindows" was successfully installed
[Warning]: The service "icingapowershell" is not installed
[Warning]: The service "icingapowershell" is not installed

image

Expected Behavior

Checks should behave as before.

Current Behavior

No Plugin output of perfdata. only the checks "cluster zone", "icinga" and "ping4" show normal behaviour.

Steps to Reproduce (for bugs)

  1. enable JEA

Context

Monitoring is not possible right now.

Your Environment

  • PowerShell Version used ($PSVersionTable.PSVersion):
Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      14393  4583
  • Operating System and version (Get-IcingaWindowsInformation Win32_OperatingSystem | Select-Object Version, BuildNumber, Caption):
Version    BuildNumber Caption
-------    ----------- -------
10.0.14393 14393       Microsoft Windows Server 2016 Datacenter
@LordHepipud
Copy link
Collaborator

Hello

Thank you for the issue. Based on my research, this should already be resolved with v1.8.0.
Can you please test the following:

File: lib\core\framework\Invoke-IcingaNamespaceCmdlets.psm1

Line: 18

Remove the following

Import-Module $Cmdlet.Module.Path -WarningAction SilentlyContinue -ErrorAction Stop;

Afterwards please run

Write-IcingaFrameworkCodeCache;

Please also install the JEA profile again, but also with AllowScriptBlocks, as because of a way too aggressive checking, the current versions of plugins and hyperv will not be loaded otherwise because of the detection of ScriptBlocks (which are not present, but detected as such)

Install-IcingaSecurity -IcingaUser 'IcingaMonitoring' -AllowScriptBlocks;

The code part is already gone with Icinga for Windows v1.8.0, because no longer required: #407

@LordHepipud LordHepipud added this to the v1.8.0 milestone Jan 20, 2022
@LordHepipud LordHepipud added the Bug There is an issue present label Jan 20, 2022
@LordHepipud LordHepipud self-assigned this Jan 20, 2022
@K0nne
Copy link
Author

K0nne commented Jan 24, 2022

Hello @LordHepipud,

thank you for the advice. It's working and the check behaviour has normalized, but with one exception.
The following check has stopped working, since the reactivation of JEA (with -AllowScriptBlocks):

Plugin-Ausgabe
[UNKNOWN] Icinga Exception: Error while executing plugin in JEA context
The term 'Invoke-IcingaCheckUsedPartitionSpace' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

@LordHepipud
Copy link
Collaborator

Thank you for the update.

This seems to be a problem with the alias, as with v1.7.0 we renamed Invoke-IcingaCheckUsedPartitionSpace to Invoke-IcingaCheckPartitionSpace.

We created an alias for this, but on 2012 R2 and now with JEA this doesn't seem to work properly.
With v1.8.0 we created a native command as alias, which resolves this problem: Icinga/icinga-powershell-plugins#250

You can simply use Invoke-IcingaCheckPartitionSpace as check plugin starting with v1.7.0 which resolves the problem or wait for v1.8.0 to get both namings working,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug There is an issue present
Projects
None yet
Development

No branches or pull requests

2 participants