Skip to content

Feature: Adds support for disk health check to Invoke-IcingaCheckDiskHealth #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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 @@ -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

Expand Down
16 changes: 8 additions & 8 deletions doc/plugins/15-Invoke-IcingaCheckUptime.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:;;;
```


8 changes: 8 additions & 0 deletions plugins/Invoke-IcingaCheckDiskHealth.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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 `
Expand All @@ -240,6 +247,7 @@ function Invoke-IcingaCheckDiskHealth()
}

# Check for Disk OperationalStatus
$PartCheckPackage.AddCheck($DiskHealthStatusCheck);
$PartCheckPackage.AddCheck($DiskOfflineCheck);
$PartCheckPackage.AddCheck($DiskReadOnlyCheck);

Expand Down
10 changes: 9 additions & 1 deletion provider/disks/Get-IcingaPhysicalDiskInfo.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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 = @{ };

Expand Down
4 changes: 2 additions & 2 deletions provider/enums/Icinga_ProviderEnums.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down