diff --git a/doc/31-Changelog.md b/doc/31-Changelog.md index 11871a4..50b5f02 100644 --- a/doc/31-Changelog.md +++ b/doc/31-Changelog.md @@ -7,6 +7,14 @@ documentation before upgrading to a new release. Released closed milestones can be found on [GitHub](https://github.com/Icinga/icinga-powershell-plugins/milestones?state=closed). +## 1.14.1 (tbd) + +[Issue and PRs](https://github.com/Icinga/icinga-powershell-plugins/milestone/23) + +### Bugfixes + +* [#471](https://github.com/Icinga/icinga-powershell-plugins/pull/471) Fixes `Invoke-IcingaCheckPartitionSpace` to report `UNKNOWN` if no usage data was used, which was previously handled by "No disk size available". As we now properly receive disk size data but still no usage data in these cases, we receive false positives + ## 1.14.0 (2026-02-11) [Issue and PRs](https://github.com/Icinga/icinga-powershell-plugins/milestone/22) diff --git a/plugins/Invoke-IcingaCheckUsedPartitionSpace.psm1 b/plugins/Invoke-IcingaCheckUsedPartitionSpace.psm1 index 0c212c5..9406644 100644 --- a/plugins/Invoke-IcingaCheckUsedPartitionSpace.psm1 +++ b/plugins/Invoke-IcingaCheckUsedPartitionSpace.psm1 @@ -181,6 +181,12 @@ function Invoke-IcingaCheckPartitionSpace() } else { $IcingaCheck.SetOk('No disk size available', $TRUE) | Out-Null; } + } elseif ([string]::IsNullOrEmpty($partition.FreeSpace) -or [string]::IsNullOrEmpty($partition.UsedSpace)) { + if ($SkipUnknown -eq $FALSE) { + $IcingaCheck.SetUnknown('No disk usage size available', $TRUE) | Out-Null; + } else { + $IcingaCheck.SetOk('No disk usage available', $TRUE) | Out-Null; + } } else { $IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Critical) | Out-Null; } diff --git a/provider/disks/Get-IcingaPartitionSpace.psm1 b/provider/disks/Get-IcingaPartitionSpace.psm1 index 8a33b0b..bff2601 100644 --- a/provider/disks/Get-IcingaPartitionSpace.psm1 +++ b/provider/disks/Get-IcingaPartitionSpace.psm1 @@ -36,12 +36,18 @@ function Get-IcingaPartitionSpace() break; } + $UsedSpace = $null; + + if ($null -ne $disk.FreeSpace) { + $UsedSpace = $DiskSize - [decimal]$disk.FreeSpace; + } + $DiskData.Add( $disk.Name, @{ 'Size' = $DiskSize; 'FreeSpace' = $disk.FreeSpace; - 'UsedSpace' = ($DiskSize - $disk.FreeSpace); + 'UsedSpace' = $UsedSpace; 'DriveLetter' = $disk.DriveLetter; 'DriveName' = $disk.Name; 'HasLetter' = -not [string]::IsNullOrEmpty($disk.DriveLetter);