-
Notifications
You must be signed in to change notification settings - Fork 33
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
Powershell-framework 1.10 - Register-IcingaServiceCheck results in powershell errors #582
Comments
I am facing the same issue, background check registration seems to be broken with 1.10.0 Further informations regarding the error
According to the error messages, it seems like the framework cache is causing the problems. |
Some more context, because i have been analyzing the problem: |
Update |
ref/NC/766230 |
I did some digging into this issue and I can't seem to be able to reproduce with with v1.10.0. Please note that there was one change with the command, which now specifies the intervals based on the time unit. If you add a service check with
I can't however not get the above mentioned error. Once I register the service check, it just works. I will try on a newly installed machine in addition to test further. For existing config: The migration is done by default to the new minute handling. Therefor you do not need to worry about that. I just realised this slipped through the upgrading docs statement and will update this including the examples to ensure we are all on track regading this change. |
I get the same errors: Register-IcingaServiceCheck -CheckCommand 'Invoke-IcingaCheckCPU' -Interval 30 -TimeIndexes 1m, 5m, 15m
|
In case you are running into this problem, can you please run this command on PowerShell and try again? if ($null -eq (Get-IcingaPowerShellConfig -Path 'BackgroundDaemon.RegisteredServices')) {
Remove-IcingaPowerShellConfig -Path 'BackgroundDaemon.RegisteredServices';
} This should resolve the issue. I will provide an automated fix for this with v1.10.1, which will run this command during the migration tasks. v1.10.1 will also fix the previous migration task which broke the config for the registration. This error only occured if no service check definitions were defined before. |
Thanks @LordHepipud, that worked! PS C:\> if ($null -eq (Get-IcingaPowerShellConfig -Path 'BackgroundDaemon.RegisteredServices')) {
>> Remove-IcingaPowerShellConfig -Path 'BackgroundDaemon.RegisteredServices';
>> }
PS C:\> Register-IcingaServiceCheck -CheckCommand 'Invoke-IcingaCheckCPU' -Interval 30 -TimeIndexes 1m, 5m, 15m
[Notice]: Icinga background service check has been added
PS C:\> 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/
Invoke-IcingaCheckCPU
-----------
Arguments =>
CheckCommand => Invoke-IcingaCheckCPU
Id => 1234
Interval => 30
TimeIndexes => 1m, 5m, 15m |
Expected Behavior
Register Background Daemon and Service Checks to collect metrics over time should work.
Register-IcingaBackgroundDaemon -Command 'Start-IcingaServiceCheckDaemon';
Register-IcingaServiceCheck -CheckCommand 'Invoke-IcingaCheckCPU' -Interval 30 -TimeIndexes 1, 3, 5, 15;
Show-IcingaRegisteredServiceChecks;
Current Behavior
Register-IcingaServiceCheck fails and print several powershell errors:
Add-Member : Cannot bind argument to parameter 'InputObject' because it is null.
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:411 char:21
... figObject | Add-Member -MemberType NoteProperty -Name $ConfigKey -Val ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : InvalidData: (:) [Add-Member], ParameterBindingValidationException
FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.AddMemberCommand
Possible Solution
Steps to Reproduce (for bugs)
Register-IcingaBackgroundDaemon -Command 'Start-IcingaServiceCheckDaemon';
Register-IcingaServiceCheck -CheckCommand 'Invoke-IcingaCheckCPU' -Interval 30 -TimeIndexes 1, 3, 5, 15;
Context
collect metrics over time not usable with framework 1.10
Your Environment
$PSVersionTable.PSVersion
):Major Minor Build Revision
5_______1_____17763__592
Get-IcingaWindowsInformation Win32_OperatingSystem | Select-Object Version, BuildNumber, Caption
):Version_____BuildNumber__Caption
10.0.17763__17763______Microsoft Windows Server 2019 Standard Evaluation
(fresh installed to exclude possible side effects)
The text was updated successfully, but these errors were encountered: