Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/31-Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#285](https://github.com/Icinga/icinga-powershell-framework/issues/285) Fixes plain Icinga 2 conf generation for commands, which was caused by a new exception output for additional output
* [#293](https://github.com/Icinga/icinga-powershell-framework/pull/293) Fixes crash on REST-Api for NULL values while parsing the REST message
* [#295](https://github.com/Icinga/icinga-powershell-framework/issues/295) Fixes background service check daemon not working with arguments for plugins
* [#297](https://github.com/Icinga/icinga-powershell-framework/pull/297) Fixes null exception error which can occur in certain edge cases, caused by testing `New-IcingaCheck` directly without function wrapper

## 1.5.0 (2021-06-02)

Expand Down
24 changes: 24 additions & 0 deletions lib/icinga/plugin/Get-IcingaThresholdCache.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function Get-IcingaThresholdCache()
{
param (
[string]$CheckCommand = $null
);

if ([string]::IsNullOrEmpty($CheckCommand)) {
return $null;
}

if ($null -eq $Global:Icinga) {
return $null;
}

if ($Global:Icinga.ContainsKey('ThresholdCache') -eq $FALSE) {
return $null;
}

if ($Global:Icinga.ThresholdCache.ContainsKey($CheckCommand) -eq $FALSE) {
return $null;
}

return $Global:Icinga.ThresholdCache[$CheckCommand];
}
2 changes: 1 addition & 1 deletion lib/icinga/plugin/New-IcingaCheck.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ function New-IcingaCheck()
'-BaseValue' = $this.BaseValue;
'-Unit' = $this.Unit;
'-CheckName' = $this.__GetName();
'-ThresholdCache' = $Global:Icinga.ThresholdCache[$this.__CheckCommand];
'-ThresholdCache' = (Get-IcingaThresholdCache -CheckCommand $this.__CheckCommand);
'-Translation' = $this.Translation;
'-TimeInterval' = $this.__TimeInterval;
};
Expand Down