Skip to content

Commit 5aa38f9

Browse files
authored
Merge pull request #444 from Icinga:feature/adds_disk_health_check_to_disk_health_plugin
Feature: Adds support for disk health check to Invoke-IcingaCheckDiskHealth Adds support for disk health check to `Invoke-IcingaCheckDiskHealth` (thanks @audiocoach)
2 parents 76844af + f138468 commit 5aa38f9

File tree

5 files changed

+28
-11
lines changed

5 files changed

+28
-11
lines changed

doc/31-Changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
2626

2727
### Enhancements
2828

29+
* [#389](https://github.com/Icinga/icinga-powershell-plugins/issues/389) Adds support for disk health check to `Invoke-IcingaCheckDiskHealth` (thanks @audiocoach)
2930
* [#408](https://github.com/Icinga/icinga-powershell-plugins/issues/408) Adds support for `Invoke-IcingaCheckDiskHealth` to filter disks by their friendly name
3031
* [#430](https://github.com/Icinga/icinga-powershell-plugins/issues/430) Adds support for `Invoke-IcingaCheckHTTPStatus` to allow for ignoring SSL/TLS errors
3132

doc/plugins/15-Invoke-IcingaCheckUptime.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,29 @@ To execute this plugin you will require to grant the following user permissions.
3131
### Example Command 1
3232

3333
```powershell
34-
Invoke-IcingaCheckUptime -Warning 18d -Critical 20d
34+
Invoke-IcingaCheckUptime -Warning '10m'
3535
```
3636

3737
### Example Output 1
3838

3939
```powershell
40-
[WARNING]: Check package "Windows Uptime: Days: 19 Hours: 13 Minutes: 48 Seconds: 29" is [WARNING]
41-
| 'Windows Uptime'=1691309,539176s;1555200;1728000
40+
[WARNING] System Uptime: 0d 1h 25m 50s [WARNING] System Uptime
41+
\_ [WARNING] System Uptime: Value 1.43h is greater than threshold 10m
42+
| windows::ifw_uptime::uptime=5149.979s;600;;;
4243
```
4344

4445
### Example Command 2
4546

4647
```powershell
47-
Invoke-IcingaCheckUptime -Warning 25d:
48+
Invoke-IcingaCheckUptime -Warning '2h:'
4849
```
4950

5051
### Example Output 2
5152

5253
```powershell
53-
[WARNING] Check package "System Uptime: 22d 16h 42m 35s" - [WARNING] System Uptime
54-
\_ [WARNING] System Uptime: Value "1960955.28s" is lower than threshold "2160000s"
55-
| 'system_uptime'=1960955.28s;2160000:;
56-
1
54+
[WARNING] System Uptime: 0d 1h 28m 40s [WARNING] System Uptime
55+
\_ [WARNING] System Uptime: Value 1.48h is lower than threshold 2h
56+
| windows::ifw_uptime::uptime=5319.563s;7200:;;;
5757
```
5858

5959

plugins/Invoke-IcingaCheckDiskHealth.psm1

+8
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,13 @@ function Invoke-IcingaCheckDiskHealth()
221221

222222
$PartCheckPackage.AddCheck($OperationalStatusPackage);
223223

224+
$DiskHealthStatusCheck = New-IcingaCheck `
225+
-Name ([string]::Format('{0} Health Status', $Partition)) `
226+
-Value ([string]$DiskObjects.Data.HealthStatus.Name) `
227+
-NoPerfData;
228+
229+
$DiskHealthStatusCheck.WarnIfMatch('Warning').CritIfMatch('Unhealthy').CritIfMatch('Unknown') | Out-Null;
230+
224231
$DiskOfflineCheck = New-IcingaCheck `
225232
-Name ([string]::Format('{0} Is Offline', $Partition)) `
226233
-Value $DiskObjects.Data.IsOffline `
@@ -240,6 +247,7 @@ function Invoke-IcingaCheckDiskHealth()
240247
}
241248

242249
# Check for Disk OperationalStatus
250+
$PartCheckPackage.AddCheck($DiskHealthStatusCheck);
243251
$PartCheckPackage.AddCheck($DiskOfflineCheck);
244252
$PartCheckPackage.AddCheck($DiskReadOnlyCheck);
245253

provider/disks/Get-IcingaPhysicalDiskInfo.psm1

+9-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,15 @@ function Global:Get-IcingaPhysicalDiskInfo()
223223
'name' = (Get-IcingaProviderEnumData -Enum $ProviderEnums -Key 'DiskBusType' -Index $disk.BusType);
224224
}
225225
)
226-
$DiskInfo.Add('HealthStatus', $disk.HealthStatus);
226+
227+
$DiskInfo.Add(
228+
'HealthStatus',
229+
@{
230+
'Value' = $disk.HealthStatus;
231+
'Name' = (Get-IcingaProviderEnumData -Enum $ProviderEnums -Key 'StorageHealthStatus' -Index $disk.HealthStatus);
232+
}
233+
);
234+
227235
if ($null -ne $disk.OperationalStatus) {
228236
$OperationalStatus = @{ };
229237

provider/enums/Icinga_ProviderEnums.psm1

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
##################################################################################################>
55

66
[hashtable]$BiosCharacteristics = @{
7-
0 = 'Reserved';
8-
1 = 'Reserved';
7+
0 = 'Reserved';
8+
1 = 'Reserved';
99
2 = 'Unknown';
1010
3 = 'BIOS Characteristics Not Supported';
1111
4 = 'ISA is supported';

0 commit comments

Comments
 (0)