|
13 | 13 |
|
14 | 14 | * Root\Cimv2 |
15 | 15 | .EXAMPLE |
16 | | - PS> Invoke-IcingaCheckUptime -Warning 18d -Critical 20d |
17 | | - [WARNING]: Check package "Windows Uptime: Days: 19 Hours: 13 Minutes: 48 Seconds: 29" is [WARNING] |
18 | | - | 'Windows Uptime'=1691309,539176s;1555200;1728000 |
| 16 | + PS> Invoke-IcingaCheckUptime -Warning '10m' |
| 17 | + [WARNING] System Uptime: 0d 1h 25m 50s [WARNING] System Uptime |
| 18 | + \_ [WARNING] System Uptime: Value 1.43h is greater than threshold 10m |
| 19 | + | windows::ifw_uptime::uptime=5149.979s;600;;; |
19 | 20 | .EXAMPLE |
20 | | - PS> Invoke-IcingaCheckUptime -Warning 25d: |
21 | | - [WARNING] Check package "System Uptime: 22d 16h 42m 35s" - [WARNING] System Uptime |
22 | | - \_ [WARNING] System Uptime: Value "1960955.28s" is lower than threshold "2160000s" |
23 | | - | 'system_uptime'=1960955.28s;2160000:; |
24 | | - 1 |
| 21 | + PS> Invoke-IcingaCheckUptime -Warning '2h:' |
| 22 | + [WARNING] System Uptime: 0d 1h 28m 40s [WARNING] System Uptime |
| 23 | + \_ [WARNING] System Uptime: Value 1.48h is lower than threshold 2h |
| 24 | + | windows::ifw_uptime::uptime=5319.563s;7200:;;; |
25 | 25 | .PARAMETER Warning |
26 | 26 | Used to specify a Warning threshold. In this case a string. |
27 | 27 | Allowed units include: ms, s, m, h, d, w, M, y |
@@ -54,7 +54,9 @@ function Invoke-IcingaCheckUptime() |
54 | 54 | ); |
55 | 55 |
|
56 | 56 | $WindowsData = Get-IcingaWindows; |
57 | | - $Name = ([string]::Format('System Uptime: {0}', (ConvertFrom-TimeSpan -Seconds $WindowsData.windows.metadata.uptime.value).Replace(',', '.'))); |
| 57 | + $TimeSpan = New-TimeSpan -Seconds $WindowsData.windows.metadata.uptime.value; |
| 58 | + $UptimeHR = [string]::Format('{0}d {1}h {2}m {3}s', $TimeSpan.Days, $TimeSpan.Hours, $TimeSpan.Minutes, $TimeSpan.Seconds); |
| 59 | + $Name = [string]::Format('System Uptime: {0}', $UptimeHR); |
58 | 60 |
|
59 | 61 | $CheckPackage = New-IcingaCheckPackage -Name $Name -OperatorAnd -Verbose $Verbosity; |
60 | 62 |
|
|
0 commit comments