From 1a43cf36dac5e8d22c4a890671a593128abe89c9 Mon Sep 17 00:00:00 2001 From: Crited Date: Mon, 22 Jul 2019 15:53:07 +0200 Subject: [PATCH] Binary-Addition in relevant files for enums --- lib/provider/memory/Icinga_ProviderMemory.psm1 | 10 +++++++++- lib/provider/windows/Icinga_ProviderWindows.psm1 | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/provider/memory/Icinga_ProviderMemory.psm1 b/lib/provider/memory/Icinga_ProviderMemory.psm1 index cbe0a9c..89e544d 100644 --- a/lib/provider/memory/Icinga_ProviderMemory.psm1 +++ b/lib/provider/memory/Icinga_ProviderMemory.psm1 @@ -8,6 +8,14 @@ function Get-IcingaMemory () [hashtable]$MEMData = @{}; foreach($memory in $MEMInformation) { + + $TypeDetail = @(); + $ProviderEnums.MemoryTypeDetail.Keys | Where-Object { + $_ -band $memory.TypeDetail + } | ForEach-Object { + $TypeDetail += $ProviderEnums.MemoryTypeDetail.Get_Item($_); + }; + $MEMData.Add( $memory.tag.trim("Physical Memory"), @{ 'metadata' = @{ @@ -46,7 +54,7 @@ function Get-IcingaMemory () }; 'TypeDetail' = @{ 'raw' = $memory.TypeDetail; - 'value' = $ProviderEnums.MemoryTypeDetail[[int]$memory.TypeDetail]; + 'value' = $TypeDetail; }; }; 'specs' = @{ diff --git a/lib/provider/windows/Icinga_ProviderWindows.psm1 b/lib/provider/windows/Icinga_ProviderWindows.psm1 index 068ce6d..57b1a88 100644 --- a/lib/provider/windows/Icinga_ProviderWindows.psm1 +++ b/lib/provider/windows/Icinga_ProviderWindows.psm1 @@ -1,9 +1,17 @@ Import-Module $IncludeDir\provider\enums\Icinga_ProviderEnums; + function Get-IcingaWindows() { $WindowsInformations = Get-CimInstance Win32_OperatingSystem; + $OSProductSuite = @(); + $ProviderEnums.WindowsOSProductSuite.Keys | Where-Object { + $_ -band $WindowsInformations.OSProductSuite + } | ForEach-Object { + $OSProductSuite += $ProviderEnums.WindowsOSProductSuite.Get_Item($_); + }; + $windows_datails = @{}; $windows_datails.Add( 'windows', @{ @@ -23,7 +31,7 @@ function Get-IcingaWindows() }; 'OSProductSuite' = @{ 'raw' = $WindowsInformations.OSProductSuite; - 'value' = $ProviderEnums.WindowsOSProductSuite[[int]$WindowsInformations.OSProductSuite]; + 'value' = $OSProductSuite; }; 'ProductType' = @{ 'raw' = $WindowsInformations.ProductType;