diff --git a/doc/31-Changelog.md b/doc/31-Changelog.md index 150d7faf..3410007f 100644 --- a/doc/31-Changelog.md +++ b/doc/31-Changelog.md @@ -26,6 +26,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic ### Enhancements +* [#389](https://github.com/Icinga/icinga-powershell-plugins/issues/389) Adds support for disk health check to `Invoke-IcingaCheckDiskHealth` (thanks @audiocoach) * [#408](https://github.com/Icinga/icinga-powershell-plugins/issues/408) Adds support for `Invoke-IcingaCheckDiskHealth` to filter disks by their friendly name * [#430](https://github.com/Icinga/icinga-powershell-plugins/issues/430) Adds support for `Invoke-IcingaCheckHTTPStatus` to allow for ignoring SSL/TLS errors diff --git a/doc/plugins/15-Invoke-IcingaCheckUptime.md b/doc/plugins/15-Invoke-IcingaCheckUptime.md index 7006c2f2..8273d30e 100644 --- a/doc/plugins/15-Invoke-IcingaCheckUptime.md +++ b/doc/plugins/15-Invoke-IcingaCheckUptime.md @@ -31,29 +31,29 @@ To execute this plugin you will require to grant the following user permissions. ### Example Command 1 ```powershell -Invoke-IcingaCheckUptime -Warning 18d -Critical 20d +Invoke-IcingaCheckUptime -Warning '10m' ``` ### Example Output 1 ```powershell -[WARNING]: Check package "Windows Uptime: Days: 19 Hours: 13 Minutes: 48 Seconds: 29" is [WARNING] -| 'Windows Uptime'=1691309,539176s;1555200;1728000 +[WARNING] System Uptime: 0d 1h 25m 50s [WARNING] System Uptime +\_ [WARNING] System Uptime: Value 1.43h is greater than threshold 10m +| windows::ifw_uptime::uptime=5149.979s;600;;; ``` ### Example Command 2 ```powershell -Invoke-IcingaCheckUptime -Warning 25d: +Invoke-IcingaCheckUptime -Warning '2h:' ``` ### Example Output 2 ```powershell -[WARNING] Check package "System Uptime: 22d 16h 42m 35s" - [WARNING] System Uptime -\_ [WARNING] System Uptime: Value "1960955.28s" is lower than threshold "2160000s" -| 'system_uptime'=1960955.28s;2160000:; -1 +[WARNING] System Uptime: 0d 1h 28m 40s [WARNING] System Uptime +\_ [WARNING] System Uptime: Value 1.48h is lower than threshold 2h +| windows::ifw_uptime::uptime=5319.563s;7200:;;; ``` diff --git a/plugins/Invoke-IcingaCheckDiskHealth.psm1 b/plugins/Invoke-IcingaCheckDiskHealth.psm1 index 3a7703b8..3991ce03 100644 --- a/plugins/Invoke-IcingaCheckDiskHealth.psm1 +++ b/plugins/Invoke-IcingaCheckDiskHealth.psm1 @@ -221,6 +221,13 @@ function Invoke-IcingaCheckDiskHealth() $PartCheckPackage.AddCheck($OperationalStatusPackage); + $DiskHealthStatusCheck = New-IcingaCheck ` + -Name ([string]::Format('{0} Health Status', $Partition)) ` + -Value ([string]$DiskObjects.Data.HealthStatus.Name) ` + -NoPerfData; + + $DiskHealthStatusCheck.WarnIfMatch('Warning').CritIfMatch('Unhealthy').CritIfMatch('Unknown') | Out-Null; + $DiskOfflineCheck = New-IcingaCheck ` -Name ([string]::Format('{0} Is Offline', $Partition)) ` -Value $DiskObjects.Data.IsOffline ` @@ -240,6 +247,7 @@ function Invoke-IcingaCheckDiskHealth() } # Check for Disk OperationalStatus + $PartCheckPackage.AddCheck($DiskHealthStatusCheck); $PartCheckPackage.AddCheck($DiskOfflineCheck); $PartCheckPackage.AddCheck($DiskReadOnlyCheck); diff --git a/provider/disks/Get-IcingaPhysicalDiskInfo.psm1 b/provider/disks/Get-IcingaPhysicalDiskInfo.psm1 index 7668cfab..80c9c178 100644 --- a/provider/disks/Get-IcingaPhysicalDiskInfo.psm1 +++ b/provider/disks/Get-IcingaPhysicalDiskInfo.psm1 @@ -223,7 +223,15 @@ function Global:Get-IcingaPhysicalDiskInfo() 'name' = (Get-IcingaProviderEnumData -Enum $ProviderEnums -Key 'DiskBusType' -Index $disk.BusType); } ) - $DiskInfo.Add('HealthStatus', $disk.HealthStatus); + + $DiskInfo.Add( + 'HealthStatus', + @{ + 'Value' = $disk.HealthStatus; + 'Name' = (Get-IcingaProviderEnumData -Enum $ProviderEnums -Key 'StorageHealthStatus' -Index $disk.HealthStatus); + } + ); + if ($null -ne $disk.OperationalStatus) { $OperationalStatus = @{ }; diff --git a/provider/enums/Icinga_ProviderEnums.psm1 b/provider/enums/Icinga_ProviderEnums.psm1 index 334e5e7a..e98ac5a4 100644 --- a/provider/enums/Icinga_ProviderEnums.psm1 +++ b/provider/enums/Icinga_ProviderEnums.psm1 @@ -4,8 +4,8 @@ ##################################################################################################> [hashtable]$BiosCharacteristics = @{ - 0 = 'Reserved'; - 1 = 'Reserved'; + 0 = 'Reserved'; + 1 = 'Reserved'; 2 = 'Unknown'; 3 = 'BIOS Characteristics Not Supported'; 4 = 'ISA is supported';