Problem:
-ThresholdInterval with no collected metrics throws StackOverflowException (crashes the service when API Check Forwarder is enabled)
Expected Behavior:
Running a plugin with -ThresholdInterval set to an interval for which no metrics have been collected should return a graceful check result.
Current Behavior
When -ThresholdInterval is used on a host where no background service checks are registered (so no metrics-over-time data exists for any interval), the check does not return an error. Instead the process aborts with:
Process is terminated due to StackOverflowException.
Because a StackOverflowException is uncatchable in .NET/PowerShell, the entire process is torn down. When the REST API daemon and API Check Forwarder is in use, the entire Icinga Powershell service is killed.
Steps to Reproduce
- Install the Icinga for Windows PowerShell service and register the metrics daemon, but register no service checks. Confirm with:
Show-IcingaRegisteredServiceChecks
# => No background service checks configured
Show-IcingaRegisteredBackgroundDaemons
# => Start-IcingaServiceCheckDaemon
# => Start-IcingaWindowsRESTApi
- Run a plugin with
-ThresholdInterval set to any interval from the Icinga shell:
icinga { Invoke-IcingaCheckCPU -Warning 80 -Critical 90 -ThresholdInterval 15m }
- Observe the process terminate with
Process is terminated due to StackOverflowException.
instead of a graceful result.
- With the API Check Forwarder enabled, triggering the same check through forwarded
execution crashes the entire Icinga for Windows PowerShell service.
Environment
- Icinga for Windows / framework version:
1.14.2
- Plugins version:
1.14.1
- PowerShell version
5.1.17763.8755
- Icinga 2 Agent version:
2.16.1
Problem:
-ThresholdIntervalwith no collected metrics throwsStackOverflowException(crashes the service when API Check Forwarder is enabled)Expected Behavior:
Running a plugin with
-ThresholdIntervalset to an interval for which no metrics have been collected should return a graceful check result.Current Behavior
When
-ThresholdIntervalis used on a host where no background service checks are registered (so no metrics-over-time data exists for any interval), the check does not return an error. Instead the process aborts with:Because a
StackOverflowExceptionis uncatchable in .NET/PowerShell, the entire process is torn down. When the REST API daemon and API Check Forwarder is in use, the entire Icinga Powershell service is killed.Steps to Reproduce
-ThresholdIntervalset to any interval from the Icinga shell:icinga { Invoke-IcingaCheckCPU -Warning 80 -Critical 90 -ThresholdInterval 15m }Process is terminated due to StackOverflowException.instead of a graceful result.
execution crashes the entire Icinga for Windows PowerShell service.
Environment
1.14.21.14.15.1.17763.87552.16.1