diff --git a/doc/31-Changelog.md b/doc/31-Changelog.md index 17329ea2..3f87f325 100644 --- a/doc/31-Changelog.md +++ b/doc/31-Changelog.md @@ -21,6 +21,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic * [#217](https://github.com/Icinga/icinga-powershell-plugins/issues/217) Adds feature for `Invoke-IcingaCheckPerfCounter` with new switch `-IgnoreEmptyChecks` to change the output from `UNKNOWN` to `OK`, in case no performance counters were found * [#222](https://github.com/Icinga/icinga-powershell-plugins/pull/222) Replaces `Get-FileHash` with own implementation as `Get-IcingaFileHash`, to work with new JEA integration * [#223](https://github.com/Icinga/icinga-powershell-plugins/pull/223) Removes the function `Get-IcingaServices`, as this function has been moved to the Icinga PowerShell Framework +* [#225](https://github.com/Icinga/icinga-powershell-plugins/pull/225) Adds support for plugins to work in JEA context ## 1.5.1 (2021-07-07) diff --git a/provider/enums/Icinga_ProviderEnums.psm1 b/provider/enums/Icinga_ProviderEnums.psm1 index b90a6e02..be093072 100644 --- a/provider/enums/Icinga_ProviderEnums.psm1 +++ b/provider/enums/Icinga_ProviderEnums.psm1 @@ -966,25 +966,21 @@ } [hashtable]$Stratum = @{ - 'UnspecifiedOrUnavailable' = 0; - 'PrimaryReference' = 1; - 'SecondaryReferenceNTPOrSNTP' = {$_ -ge 2 -and $_ -le 15}; - 'Reserved' = {$_ -gt 16}; + 'UnspecifiedOrUnavailable' = 0; + 'PrimaryReference' = 1; } [hashtable]$StratumTxt = @{ - 0 = 'UnspecifiedOrUnavailable'; - 1 = 'PrimaryReference'; - {$_ -ge 2 -and $_ -le 15} = 'SecondaryReferenceNTPOrSNTP'; - {$_ -gt 16} = 'Reserved'; + 0 = 'UnspecifiedOrUnavailable'; + 1 = 'PrimaryReference'; } [hashtable]$DeviceAccessName = @{ - 0 = 'Unknown'; - 1 = 'Readable'; - 2 = 'Writeable'; - 3 = 'Read/Write Supported'; - 4 = 'Write Once'; + 0 = 'Unknown'; + 1 = 'Readable'; + 2 = 'Writeable'; + 3 = 'Read/Write Supported'; + 4 = 'Write Once'; } [hashtable]$DeviceAccess = @{ diff --git a/provider/http/Get-IcingaCheckHTTPQuery.psm1 b/provider/http/Get-IcingaCheckHTTPQuery.psm1 index c03279f7..2ec94c80 100644 --- a/provider/http/Get-IcingaCheckHTTPQuery.psm1 +++ b/provider/http/Get-IcingaCheckHTTPQuery.psm1 @@ -100,29 +100,20 @@ function Get-IcingaCheckHTTPQuery() } else { # Defaults if (Test-Numeric $HTTPInformation.StatusCode) { - switch ($HTTPInformation.StatusCode) { - { $_ -eq $null } { - $Status = $IcingaEnums.IcingaExitCode.Unknown - }; - { $_ -lt 200 } { # < 200 Unknown - $Status = $IcingaEnums.IcingaExitCode.Unknown - } - { $_ -ge 600 } { # >= 600 Unknown - $Status = $IcingaEnums.IcingaExitCode.Unknown - } - { $_ -In 200..399 } { # 200-399 OK - $Status = $IcingaEnums.IcingaExitCode.OK - } - { $_ -In 400..499 } { # 400-499 Warning - $Status = $IcingaEnums.IcingaExitCode.Warning - } - { $_ -In 500..599 } { # 500-599 Critical - $Status = $IcingaEnums.IcingaExitCode.Critical - } - # Proprietary - Default { - $Status = $IcingaEnums.IcingaExitCode.Unknown - } + if ($HTTPInformation.StatusCode -eq $null) { + $Status = $IcingaEnums.IcingaExitCode.Unknown; + } elseif ($HTTPInformation.StatusCode -lt 200) { # < 200 Unknown + $Status = $IcingaEnums.IcingaExitCode.Unknown; + } elseif ($HTTPInformation.StatusCode -ge 600) { # >= 600 Unknown + $Status = $IcingaEnums.IcingaExitCode.Unknown; + } elseif ($HTTPInformation.StatusCode -In 200..399) { # 200-399 OK + $Status = $IcingaEnums.IcingaExitCode.OK; + } elseif ($HTTPInformation.StatusCode -In 400..499) { # 400-499 Warning + $Status = $IcingaEnums.IcingaExitCode.Warning; + } elseif ($HTTPInformation.StatusCode -In 500..599) { # 500-599 Critical + $Status = $IcingaEnums.IcingaExitCode.Critical; + } else { + $Status = $IcingaEnums.IcingaExitCode.Unknown; # Proprietary } } else { $Status = $IcingaEnums.IcingaExitCode.Unknown; diff --git a/provider/ntp/Get-IcingaNtpData.psm1 b/provider/ntp/Get-IcingaNtpData.psm1 index dac77029..e479a183 100644 --- a/provider/ntp/Get-IcingaNtpData.psm1 +++ b/provider/ntp/Get-IcingaNtpData.psm1 @@ -123,7 +123,6 @@ function Get-IcingaNtpData() 'LocalTime' = $LocalDateTime; 'SyncStatus' = $SyncStatus; 'Stratum' = $Stratum; - 'StratumTxt' = $ProviderEnums.StratumTxt[$Stratum]; 'Mode' = $Mode; 'ModeTxt' = $ProviderEnums.ClientModeName[$Mode]; };