mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2026-02-03 04:09:29 -05:00
Fixes UNKNOWN on checks using MoT thresholds if they are newly registered
This commit is contained in:
parent
f2f935ff90
commit
38461f755a
2 changed files with 10 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
||||||
|
|
||||||
* [#787](https://github.com/Icinga/icinga-powershell-framework/pull/787) Fixes the return value in case the `Agent` component could not be installed from `$FALSE` to `null`
|
* [#787](https://github.com/Icinga/icinga-powershell-framework/pull/787) Fixes the return value in case the `Agent` component could not be installed from `$FALSE` to `null`
|
||||||
* [#796](https://github.com/Icinga/icinga-powershell-framework/issues/796) [#798](https://github.com/Icinga/icinga-powershell-framework/issues/798) Fixes an issue with the new check handling, which did not properly convert values from checks to the correct performance data values and base values in some cases
|
* [#796](https://github.com/Icinga/icinga-powershell-framework/issues/796) [#798](https://github.com/Icinga/icinga-powershell-framework/issues/798) Fixes an issue with the new check handling, which did not properly convert values from checks to the correct performance data values and base values in some cases
|
||||||
|
* [#797](https://github.com/Icinga/icinga-powershell-framework/issues/797) Fixes plugins throwing `UNKNOWN` in case `-TresholdInterval` is used for Metrics over Time, when checks are newly registered and checked, before the first MoT is executed and collected
|
||||||
|
|
||||||
## 1.13.3 (tbd)
|
## 1.13.3 (tbd)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,19 +21,27 @@ function Add-IcingaServiceCheckTask()
|
||||||
[int]$CheckInterval = ConvertTo-Seconds $Interval;
|
[int]$CheckInterval = ConvertTo-Seconds $Interval;
|
||||||
[hashtable]$CheckDataCache = @{ };
|
[hashtable]$CheckDataCache = @{ };
|
||||||
[array]$PerfDataEntries = @();
|
[array]$PerfDataEntries = @();
|
||||||
|
[bool]$ForceExecution = $FALSE;
|
||||||
|
|
||||||
if (Test-Path -Path $MetricCacheFile) {
|
if (Test-Path -Path $MetricCacheFile) {
|
||||||
$CheckDataCache = [System.Management.Automation.PSSerializer]::Deserialize((Get-Content -Path $MetricCacheFile -Raw -Encoding UTF8));
|
$CheckDataCache = [System.Management.Automation.PSSerializer]::Deserialize((Get-Content -Path $MetricCacheFile -Raw -Encoding UTF8));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# In case we run this code for the first time for a CheckCommand and no data is available, ensure we run the check immediately
|
||||||
|
# This will ensure our plugins will always return proper values and not throw unknowns, in case the execution is set to a higher interval
|
||||||
|
if ($null -eq $CheckDataCache -Or $CheckDataCache.Count -eq 0) {
|
||||||
|
$ForceExecution = $TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
while ($TRUE) {
|
while ($TRUE) {
|
||||||
if ($Global:Icinga.Private.Daemons.ServiceCheck.PassedTime -lt $CheckInterval) {
|
if ($ForceExecution -eq $FALSE -And $Global:Icinga.Private.Daemons.ServiceCheck.PassedTime -lt $CheckInterval) {
|
||||||
$Global:Icinga.Private.Daemons.ServiceCheck.PassedTime += 1;
|
$Global:Icinga.Private.Daemons.ServiceCheck.PassedTime += 1;
|
||||||
Start-Sleep -Seconds 1;
|
Start-Sleep -Seconds 1;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ForceExecution = $FALSE;
|
||||||
$Global:Icinga.Private.Daemons.ServiceCheck.PassedTime = 0;
|
$Global:Icinga.Private.Daemons.ServiceCheck.PassedTime = 0;
|
||||||
|
|
||||||
# Clear possible previous performance data from the daemon cache
|
# Clear possible previous performance data from the daemon cache
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue