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/100-General/10-Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic

* [#673](https://github.com/Icinga/icinga-powershell-framework/pull/673) Fixes a memory leak while fetching Windows EventLog information by using CLI tools and inside the Hyper-V provide
* [#678](https://github.com/Icinga/icinga-powershell-framework/pull/678) Fixes various memory leaks in Icinga for Windows API core and check handler
* [#680](https://github.com/Icinga/icinga-powershell-framework/pull/680) Fixes exception in some cases, when provider or metrics return values as `null` instead of `0` while units are being used for check objects

## 1.11.1 (2023-11-07)

Expand Down
8 changes: 7 additions & 1 deletion lib/icinga/plugin/New-IcingaCheck.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ function New-IcingaCheck()
$IcingaCheck.Name = $Name;
$IcingaCheck.__ObjectType = 'IcingaCheck';

$IcingaCheck | Add-Member -MemberType NoteProperty -Name 'Value' -Value $Value;
# Ensure we always set our current value to 0 in case it is null and we set a unit, to prevent conversion exceptions
if ([string]::IsNullOrEmpty($Unit) -eq $FALSE -And $null -eq $Value) {
$IcingaCheck | Add-Member -MemberType NoteProperty -Name 'Value' -Value 0;
} else {
$IcingaCheck | Add-Member -MemberType NoteProperty -Name 'Value' -Value $Value;
}

$IcingaCheck | Add-Member -MemberType NoteProperty -Name 'BaseValue' -Value $BaseValue;
$IcingaCheck | Add-Member -MemberType NoteProperty -Name 'Unit' -Value $Unit;
$IcingaCheck | Add-Member -MemberType NoteProperty -Name 'MetricIndex' -Value $MetricIndex;
Expand Down