mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Major fixes regarding all lib/providers, expanded upon memory.psm1, added some comments for future reference
This commit is contained in:
parent
504c18ef00
commit
8bce5c6a4c
5 changed files with 685 additions and 175 deletions
|
|
@ -1,8 +1,10 @@
|
||||||
Import-Module $IncludeDir\provider\enums;
|
Import-Module $IncludeDir\provider\enums;
|
||||||
|
|
||||||
|
<##################################################################################################
|
||||||
|
################# Runspace "Show-Icinga{BIOS}" ####################################################
|
||||||
|
##################################################################################################>
|
||||||
function Show-IcingaBiosData()
|
function Show-IcingaBiosData()
|
||||||
{
|
{
|
||||||
# Lets load some bios informations
|
|
||||||
$BIOSInformation = Get-CimInstance Win32_BIOS;
|
$BIOSInformation = Get-CimInstance Win32_BIOS;
|
||||||
[hashtable]$BIOSData = @{};
|
[hashtable]$BIOSData = @{};
|
||||||
|
|
||||||
|
|
@ -15,6 +17,40 @@ function Show-IcingaBiosData()
|
||||||
return $BIOSData;
|
return $BIOSData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<##################################################################################################
|
||||||
|
################# Runspace "Get-Icinga{BIOS}" #####################################################
|
||||||
|
##################################################################################################>
|
||||||
|
function Get-IcingaBios()
|
||||||
|
{
|
||||||
|
<# Collects the most important BIOS informations,
|
||||||
|
e.g. name, version, manufacturer#>
|
||||||
|
$BIOSInformation = Get-CimInstance Win32_BIOS;
|
||||||
|
[hashtable]$BIOSCharacteristics = @{};
|
||||||
|
[hashtable]$BIOSData = @{};
|
||||||
|
|
||||||
|
foreach ($id in $BIOSInformation.BiosCharacteristics) {
|
||||||
|
$BIOSCharacteristics.Add([string]$id, $ProviderEnums.BiosCharacteristics.Item([int]$id));
|
||||||
|
}
|
||||||
|
|
||||||
|
$BIOSData.Add(
|
||||||
|
'bios', @{
|
||||||
|
'metadata' = @{
|
||||||
|
'Name' = $BIOSInformation.Name;
|
||||||
|
'Caption' = $BIOSInformation.Caption;
|
||||||
|
'Manufacturer' = $BIOSInformation.Manufacturer;
|
||||||
|
'PrimaryBIOS' = $BIOSInformation.PrimaryBIOS;
|
||||||
|
'SerialNumber' = $BIOSInformation.SerialNumber;
|
||||||
|
'SMBIOSBIOSVersion' = $BIOSInformation.SMBIOSBIOSVersion;
|
||||||
|
'SoftwareElementID' = $BIOSInformation.SoftwareElementID;
|
||||||
|
'Status' = $BIOSInformation.Status;
|
||||||
|
'Version' = $BIOSInformation.Version;
|
||||||
|
'BiosCharacteristics' = $BIOSCharacteristics;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return $BIOSData;
|
||||||
|
}
|
||||||
|
|
||||||
function Get-IcingaBiosSerialNumber()
|
function Get-IcingaBiosSerialNumber()
|
||||||
{
|
{
|
||||||
$bios = Get-CimInstance Win32_BIOS;
|
$bios = Get-CimInstance Win32_BIOS;
|
||||||
|
|
@ -33,7 +69,7 @@ function Get-IcingaBiosManufacturer()
|
||||||
return @{'value' = $bios.Manufacturer; 'name' = 'Manufacturer'};
|
return @{'value' = $bios.Manufacturer; 'name' = 'Manufacturer'};
|
||||||
}
|
}
|
||||||
|
|
||||||
# Primary Bios seems to be relevant in dual-bios context
|
# Primary Bios might be more relevant in dual bios context
|
||||||
function Get-IcingaBiosPrimaryBios()
|
function Get-IcingaBiosPrimaryBios()
|
||||||
{
|
{
|
||||||
$bios = Get-CimInstance Win32_BIOS;
|
$bios = Get-CimInstance Win32_BIOS;
|
||||||
|
|
@ -78,7 +114,7 @@ function Get-IcingaBiosCharacteristics()
|
||||||
[hashtable]$BIOSCharacteristics = @{};
|
[hashtable]$BIOSCharacteristics = @{};
|
||||||
|
|
||||||
foreach ($id in $bios.BiosCharacteristics) {
|
foreach ($id in $bios.BiosCharacteristics) {
|
||||||
$BIOSCharacteristics.Add([int]$id, $ProviderEnums.BiosCharacteristics.([int]$id));
|
$BIOSCharacteristics.Add([string]$id, $ProviderEnums.BiosCharacteristics.Item([int]$id));
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = $BIOSCharacteristics;
|
$output = $BIOSCharacteristics;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
Import-Module $IncludeDir\provider\enums;
|
||||||
|
|
||||||
|
<##################################################################################################
|
||||||
|
################# Runspace "Show-Icinga{CPU}" #####################################################
|
||||||
|
##################################################################################################>
|
||||||
function Show-IcingaCPUData()
|
function Show-IcingaCPUData()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -15,12 +20,19 @@ foreach ($cpu_properties in $CPUInformation) {
|
||||||
return $PhysicalCPUData;
|
return $PhysicalCPUData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<##################################################################################################
|
||||||
|
################# Runspace "Get-Icinga{Memory}" ###################################################
|
||||||
|
##################################################################################################>
|
||||||
function Get-IcingaCPUs()
|
function Get-IcingaCPUs()
|
||||||
{
|
{
|
||||||
|
<# Collects the most important CPU informations,
|
||||||
|
e.g. name, version, manufacturer#>
|
||||||
$CPUInformation = Get-CimInstance Win32_Processor;
|
$CPUInformation = Get-CimInstance Win32_Processor;
|
||||||
[hashtable]$CPUData = @{};
|
[hashtable]$CPUData = @{};
|
||||||
|
|
||||||
foreach ($id in $CPUInformation.DeviceID) {
|
foreach ($id in $CPUInformation.DeviceID) {
|
||||||
|
$id=$id.trim('CPU');
|
||||||
|
|
||||||
$CPUData.Add(
|
$CPUData.Add(
|
||||||
$id, @{
|
$id, @{
|
||||||
'metadata' = @{
|
'metadata' = @{
|
||||||
|
|
@ -34,100 +46,241 @@ function Get-IcingaCPUs()
|
||||||
'Version' = $CPUInformation.Version;
|
'Version' = $CPUInformation.Version;
|
||||||
'SerialNumber' = $CPUInformation.SerialNumber;
|
'SerialNumber' = $CPUInformation.SerialNumber;
|
||||||
'Manufacturer' = $CPUInformation.Manufacturer;
|
'Manufacturer' = $CPUInformation.Manufacturer;
|
||||||
'Number of Cores' = $CPUInformation.NumberOfCores;
|
'NumberOfCores' = $CPUInformation.NumberOfCores;
|
||||||
'Family' = $CPUFamily.Family;
|
'PartNumber' = $CPUInformation.PartNumber;
|
||||||
'Architecture' = $CPUArchitecture.Architecture;
|
|
||||||
'ProcessorType' = $CPUProcessorType.ProcessorType;
|
|
||||||
'StatusInfo' = $CPUStatusInfo.StatusInfo;
|
|
||||||
'Status' = $CPUInformation.Status;
|
'Status' = $CPUInformation.Status;
|
||||||
'CPUStatus' = $CPUInformation.CpuStatus;
|
'CPUStatus' = $CPUInformation.CpuStatus;
|
||||||
'NumberOfLogicalProcessors' = $CPUStatusInfo.NumberOfLogicalProcessors;
|
'Revision' = $CPUInformation.Revision;
|
||||||
|
'NumberOfLogicalProcessors' = $CPUInformation.NumberOfLogicalProcessors;
|
||||||
'Level'= $CPUInformation.Level;
|
'Level'= $CPUInformation.Level;
|
||||||
'Availability' = $CPUAvailability.Availability;
|
'AddressWidth' = $CPUInformation.AddressWidth;
|
||||||
|
'Stepping' = $CPUInformation.Stepping;
|
||||||
|
'SocketDesignation' = $CPUInformation.SocketDesignation;
|
||||||
|
'Family' = @{
|
||||||
|
'raw' = $CPUInformation.Family;
|
||||||
|
'value' = $ProviderEnums.CPUFamily[[int]$CPUInformation.Family];
|
||||||
|
};
|
||||||
|
'Architecture' = @{
|
||||||
|
'raw' = $CPUInformation.Architecture;
|
||||||
|
'value' = $ProviderEnums.CPUArchitecture[[int]$CPUInformation.Architecture];
|
||||||
|
};
|
||||||
|
'ProcessorType' = @{
|
||||||
|
'raw' = $CPUInformation.ProcessorType;
|
||||||
|
'value' = $ProviderEnums.CPUProcessorType[[int]$CPUInformation.ProcessorType];
|
||||||
|
};
|
||||||
|
'StatusInfo' = @{
|
||||||
|
'raw' = $CPUInformation.StatusInfo;
|
||||||
|
'value' = $ProviderEnums.CPUStatusInfo[[int]$CPUInformation.StatusInfo];
|
||||||
|
};
|
||||||
|
'Availability' = @{
|
||||||
|
'raw' = $CPUInformation.Availability;
|
||||||
|
'value' = $ProviderEnums.CPUAvailability[[int]$CPUInformation.Availability];
|
||||||
|
};
|
||||||
|
'PowerManagementCapabilities' = @{
|
||||||
|
'raw' = $CPUInformation.PowerManagementCapabilities;
|
||||||
|
'value' = $ProviderEnums.CPUPowerManagementCapabilities[[int]$CPUInformation.PowerManagementCapabilities];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
'errors' = @{
|
'errors' = @{
|
||||||
'LastErrorCode' = $CPUInformation.LastErrorCode;
|
'LastErrorCode' = $CPUInformation.LastErrorCode;
|
||||||
'ErrorCleared' = $CPUInformation.ErrorCleared;
|
'ErrorCleared' = $CPUInformation.ErrorCleared;
|
||||||
'ErrorDescription' = $CPUInformation.ErrorDescription;
|
'ErrorDescription' = $CPUInformation.ErrorDescription;
|
||||||
'ConfigManagerErrorCode' = $CPUConfigManagerErrorCode.ConfigManagerErrorCode;
|
'ConfigManagerErrorCode' = @{
|
||||||
|
'raw' = [int]$CPUInformation.ConfigManagerErrorCode;
|
||||||
|
'value' = $ProviderEnums.CPUConfigManagerErrorCode.([int]$CPUInformation.ConfigManagerErrorCode);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
'perfdata' = @{
|
'specs' = @{
|
||||||
'LoadPercentage' = $CPUInformation.LoadPercentage;
|
'LoadPercentage' = $CPUInformation.LoadPercentage;
|
||||||
'CurrentVoltage' = $CPUInformation.CurrentVoltage;
|
'CurrentVoltage' = $CPUInformation.CurrentVoltage;
|
||||||
'ThreadCount' = $CPUInformation.ThreadCount;
|
'ThreadCount' = $CPUInformation.ThreadCount;
|
||||||
|
'L3CacheSize' = $CPUInformation.L3CacheSize;
|
||||||
|
'L2CacheSpeed' = $CPUInformation.L2CacheSpeed;
|
||||||
|
'L2CacheSize' = $CPUInformation.L2CacheSize;
|
||||||
|
'VoltageCaps' = $CPUInformation.VoltageCaps;
|
||||||
|
'CurrentClockSpeed' = $CPUInformation.CurrentClockSpeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return $CPUData;
|
return $CPUData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Get-IcingaCPUInformation()
|
||||||
|
{
|
||||||
|
<# Fetches the information for other more specific Get-IcingaCPU-functions
|
||||||
|
e.g. Get-IcingaCPUThreadCount; Get-IcingaCPULoadPercentage.
|
||||||
|
Can be used to fetch information regarding a value of your choice. #>
|
||||||
|
param(
|
||||||
|
[string]$Parameter
|
||||||
|
);
|
||||||
|
$CPUInformation = Get-CimInstance Win32_Processor;
|
||||||
|
[hashtable]$CPUData = @{};
|
||||||
|
|
||||||
|
foreach ($id in $CPUInformation.DeviceID) {
|
||||||
|
$CPUData.Add($id.trim('CPU'), $CPUInformation.$Parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $CPUData;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaCPUInformationWithEnums()
|
||||||
|
{ <# Fetches the information of other more specific Get-IcingaCPU-functions,
|
||||||
|
which require a enums key-value pair to resolve their code
|
||||||
|
e.g Get-IcingaCPUFamily, e.g. Get-IcingaCPUArchitecture#>
|
||||||
|
param(
|
||||||
|
[string]$Parameter
|
||||||
|
);
|
||||||
|
|
||||||
|
$CPUInformation = Get-CimInstance Win32_Processor;
|
||||||
|
$Prefix = "CPU";
|
||||||
|
|
||||||
|
[hashtable]$CPUData = @{};
|
||||||
|
|
||||||
|
foreach ($id in $CPUInformation.DeviceID) {
|
||||||
|
$id=$id.trim('CPU');
|
||||||
|
$CPUData.Add(
|
||||||
|
$id, @{
|
||||||
|
'raw' = $CPUInformation.$Parameter;
|
||||||
|
'value' = $ProviderEnums."$Prefix$Parameter"[[int]$CPUInformation.$Parameter]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $CPUData;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaCPUErrors()
|
||||||
|
{
|
||||||
|
$CPUInformation = Get-CimInstance Win32_Processor;
|
||||||
|
[hashtable]$CPUData = @{};
|
||||||
|
|
||||||
|
foreach ($id in $CPUInformation.DeviceID) {
|
||||||
|
$id=$id.trim('CPU');
|
||||||
|
$CPUData.Add(
|
||||||
|
$id, @{
|
||||||
|
'errors' = @{
|
||||||
|
'LastErrorCode' = $CPUInformation.LastErrorCode;
|
||||||
|
'ErrorCleared' = $CPUInformation.ErrorCleared;
|
||||||
|
'ErrorDescription' = $CPUInformation.ErrorDescription;
|
||||||
|
'ConfigManagerErrorCode' = @{
|
||||||
|
'raw' = [int]$CPUInformation.ConfigManagerErrorCode;
|
||||||
|
'value' = $ProviderEnums.CPUConfigManagerErrorCode.([int]$CPUInformation.ConfigManagerErrorCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $CPUData;
|
||||||
|
}
|
||||||
|
|
||||||
function Get-IcingaCPUArchitecture()
|
function Get-IcingaCPUArchitecture()
|
||||||
{
|
{
|
||||||
|
$CPUArchitecture = Get-IcingaCPUInformationWithEnums -Parameter Architecture;
|
||||||
|
|
||||||
$CPUInformation = Get-CimInstance Win32_Processor;
|
return @{'value' = $CPUArchitecture; 'name' = 'Architecture'};
|
||||||
[hashtable]$CPUArchitecture = @{};
|
|
||||||
|
|
||||||
foreach ($id in $CPUInformation.Architecture) {
|
|
||||||
$CPUArchitecture.Add([int]$id, $ProviderEnums.CPUArchitecture.([int]$id));
|
|
||||||
}
|
|
||||||
return @{'value' = $CPUArchitecture; 'name' = 'Architecture'};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-IcingaCPUProcessorType()
|
function Get-IcingaCPUProcessorType()
|
||||||
{
|
{
|
||||||
$CPUInformation = Get-CimInstance Win32_Processor;
|
$CPUProcessorType = Get-IcingaCPUInformationWithEnums -Parameter ProcessorType;
|
||||||
[hashtable]$CPUProcessorType = @{};
|
|
||||||
|
|
||||||
foreach ($id in $CPUInformation.ProcessorType) {
|
return @{'value' = $CPUProcessorType; 'name' = 'ProcessorType'};
|
||||||
$CPUProcessorType.Add([int]$id, $ProviderEnums.CPUProcessorType.([int]$id));
|
|
||||||
}
|
|
||||||
return @{'value' = $CPUProcessorType; 'name' = 'ProcessorType'};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-IcingaCPUStatusInfo()
|
function Get-IcingaCPUStatusInfo()
|
||||||
{
|
{
|
||||||
$CPUInformation = Get-CimInstance Win32_Processor;
|
$CPUStatusInfo = Get-IcingaCPUInformationWithEnums -Parameter StatusInfo;
|
||||||
[hashtable]$CPUStatusInfo = @{};
|
|
||||||
|
|
||||||
foreach ($id in $CPUInformation.StatusInfo) {
|
return @{'value' = $CPUStatusInfo; 'name' = 'StatusInfo'};
|
||||||
$CPUStatusInfo.Add([int]$id, $ProviderEnums.CPUStatusInfo.([int]$id));
|
|
||||||
}
|
|
||||||
return @{'value' = $CPUStatusInfo; 'name' = 'StatusInfo'};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-IcingaCPUFamily()
|
function Get-IcingaCPUFamily()
|
||||||
{
|
{
|
||||||
$CPUInformation = Get-CimInstance Win32_Processor;
|
$CPUFamily = Get-IcingaCPUInformationWithEnums -Parameter Family;
|
||||||
[hashtable]$CPUFamily = @{};
|
|
||||||
|
|
||||||
foreach ($id in $CPUInformation.Family) {
|
return @{'value' = $CPUFamily; 'name' = 'Family'};
|
||||||
$CPUFamily.Add([int]$id, $ProviderEnums.CPUFamily.([int]$id));
|
|
||||||
}
|
|
||||||
return @{'value' = $CPUFamily; 'name' = 'Family'};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-IcingaCPUConfigManagerErrorCode()
|
function Get-IcingaCPUConfigManagerErrorCode()
|
||||||
{
|
{
|
||||||
$CPUInformation = Get-CimInstance Win32_Processor;
|
$CPUConfigManagerErrorCode = Get-IcingaCPUInformationWithEnums -Parameter ConfigManagerErrorCode;
|
||||||
[hashtable]$CPUConfigManagerErrorCode = @{};
|
|
||||||
|
|
||||||
foreach ($id in $CPUInformation.ConfigManagerErrorCode) {
|
return @{'value' = $CPUConfigManagerErrorCode; 'name' = 'ConfigManagerErrorCode'};
|
||||||
$CPUConfigManagerErrorCode.Add([int]$id, $ProviderEnums.CPUConfigManagerErrorCode.([int]$id));
|
|
||||||
}
|
|
||||||
return @{'value' = $CPUConfigManagerErrorCode; 'name' = 'ConfigManagerErrorCode'};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-IcingaCPUAvailability()
|
function Get-IcingaCPUAvailability()
|
||||||
{
|
{
|
||||||
$CPUInformation = Get-CimInstance Win32_Processor;
|
$CPUAvailability = Get-IcingaCPUInformationWithEnums -Parameter Availability;
|
||||||
[hashtable]$CPUAvailability = @{};
|
|
||||||
|
|
||||||
foreach ($id in $CPUInformation.Availability) {
|
|
||||||
$CPUAvailability.Add([int]$id, $ProviderEnums.CPUAvailability.([int]$id));
|
|
||||||
}
|
|
||||||
|
|
||||||
return @{'value' = $CPUAvailability; 'name' = 'Availability'};
|
return @{'value' = $CPUAvailability; 'name' = 'Availability'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaCPUPowerManagementCapabilities()
|
||||||
|
{
|
||||||
|
$CPUPowerManagementCapabilities = Get-IcingaCPUInformationWithEnums -Parameter PowerManagementCapabilities;
|
||||||
|
|
||||||
|
return @{'value' = $CPUPowerManagementCapabilities; 'name' = 'PowerManagementCapabilities'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaCPULoadPercentage()
|
||||||
|
{
|
||||||
|
$CPULoadPercentage = Get-IcingaCPUInformation -Parameter LoadPercentage;
|
||||||
|
|
||||||
|
return @{'value' = $CPULoadPercentage; 'name' = 'LoadPercentage'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaCPUCurrentVoltage()
|
||||||
|
{
|
||||||
|
$CPUCurrentVoltage = Get-IcingaCPUInformation -Parameter CurrentVoltage;
|
||||||
|
|
||||||
|
return @{'value' = $CPUCurrentVoltage; 'name' = 'CurrentVoltage'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaCPUThreadCount()
|
||||||
|
{
|
||||||
|
$CPUThreadCount = Get-IcingaCPUInformation -Parameter ThreadCount;
|
||||||
|
|
||||||
|
return @{'value' = $CPUThreadCount; 'name' = 'ThreadCount'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaCPUL3CacheSize()
|
||||||
|
{
|
||||||
|
$CPUL3CacheSize = Get-IcingaCPUInformation -Parameter L3CacheSize;
|
||||||
|
|
||||||
|
return @{'value' = $CPUL3CacheSize; 'name' = 'L3CacheSize'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaCPUL2CacheSize()
|
||||||
|
{
|
||||||
|
$CPUL2CacheSize = Get-IcingaCPUInformation -Parameter L2CacheSize;
|
||||||
|
|
||||||
|
return @{'value' = $CPUL2CacheSize; 'name' = 'L2CacheSize'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaCPUL2CacheSpeed()
|
||||||
|
{
|
||||||
|
$CPUL2CacheSpeed = Get-IcingaCPUInformation -Parameter L2CacheSpeed;
|
||||||
|
|
||||||
|
return @{'value' = $CPUL2CacheSpeed; 'name' = 'L2CacheSpeed'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaCPUVoltageCaps()
|
||||||
|
{
|
||||||
|
$CPUVoltageCaps = Get-IcingaCPUInformation -Parameter VoltageCaps;
|
||||||
|
|
||||||
|
return @{'value' = $CPUVoltageCaps; 'name' = 'VoltageCaps'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaCPUCurrentClockSpeed()
|
||||||
|
{
|
||||||
|
$CPUCurrentClockSpeed = Get-IcingaCPUInformation -Parameter CurrentClockSpeed;
|
||||||
|
|
||||||
|
return @{'value' = $CPUCurrentClockSpeed; 'name' = 'CurrentClockSpeed'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaCPUNumberOfLogicalProcessors()
|
||||||
|
{
|
||||||
|
$CPUNumberOfLogicalProcessors = Get-IcingaCPUInformation -Parameter NumberOfLogicalProcessors;
|
||||||
|
|
||||||
|
return @{'value' = $CPUNumberOfLogicalProcessors; 'name' = 'NumberOfLogicalProcessors'};
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,10 @@
|
||||||
function Show-IcingaDiskFullData {
|
Import-Module $IncludeDir\provider\enums;
|
||||||
|
|
||||||
|
<##################################################################################################
|
||||||
|
################# Runspace "Show-Icinga{Disk}" ####################################################
|
||||||
|
##################################################################################################>
|
||||||
|
|
||||||
|
function Show-IcingaDiskData {
|
||||||
|
|
||||||
$DisksInformations = Get-CimInstance Win32_DiskDrive;
|
$DisksInformations = Get-CimInstance Win32_DiskDrive;
|
||||||
|
|
||||||
|
|
@ -84,8 +90,15 @@ function Show-IcingaDiskPhysical()
|
||||||
return $PhysicalDiskData;
|
return $PhysicalDiskData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<##################################################################################################
|
||||||
|
################# Runspace "Get-Icinga{Disk}" ####################################################
|
||||||
|
##################################################################################################>
|
||||||
|
|
||||||
function Get-IcingaDiskInformation()
|
function Get-IcingaDiskInformation()
|
||||||
{
|
{
|
||||||
|
<# Fetches the information for other more specific Get-IcingaDisk-functions
|
||||||
|
e.g. Get-IcingaDiskModel; Get-IcingaDiskManufacturer.
|
||||||
|
Can be used to fetch information regarding a value of your choice. #>
|
||||||
param(
|
param(
|
||||||
# The value to fetch from Win32_DiskDrive
|
# The value to fetch from Win32_DiskDrive
|
||||||
[string]$Parameter
|
[string]$Parameter
|
||||||
|
|
@ -93,7 +106,7 @@ function Get-IcingaDiskInformation()
|
||||||
$DiskInformation = Get-CimInstance Win32_DiskDrive;
|
$DiskInformation = Get-CimInstance Win32_DiskDrive;
|
||||||
[hashtable]$DiskData = @{};
|
[hashtable]$DiskData = @{};
|
||||||
|
|
||||||
foreach ($id in $DiskInformation.DeviceID) {
|
foreach ($id in $DiskInformation.DeviceID) {
|
||||||
$id = $id.trimstart(".\PHYSICALDRVE");
|
$id = $id.trimstart(".\PHYSICALDRVE");
|
||||||
$DiskData.Add($id.trim(), $DiskInformation.$Parameter);
|
$DiskData.Add($id.trim(), $DiskInformation.$Parameter);
|
||||||
}
|
}
|
||||||
|
|
@ -102,6 +115,9 @@ function Get-IcingaDiskInformation()
|
||||||
}
|
}
|
||||||
function Get-IcingaDiskPartitions()
|
function Get-IcingaDiskPartitions()
|
||||||
{
|
{
|
||||||
|
<# Fetches all the most important informations regarding partitions
|
||||||
|
e.g. physical disk; partition, size
|
||||||
|
, also collects partition information for Get-IcingaDisks #>
|
||||||
$LogicalDiskInfo = Get-WmiObject Win32_LogicalDiskToPartition;
|
$LogicalDiskInfo = Get-WmiObject Win32_LogicalDiskToPartition;
|
||||||
[hashtable]$PartitionDiskByDriveLetter = @{};
|
[hashtable]$PartitionDiskByDriveLetter = @{};
|
||||||
|
|
||||||
|
|
@ -141,7 +157,7 @@ function Get-IcingaDiskPartitionSize()
|
||||||
|
|
||||||
[hashtable]$PartitionSizeByDriveLetter = @{};
|
[hashtable]$PartitionSizeByDriveLetter = @{};
|
||||||
|
|
||||||
# Should be dependent on the driveLetters returned in: "Show-IcingaDiskFullData"
|
# Should be dependent on the driveLetters returned in: "Show-IcingaDiskData"
|
||||||
for ($test = 0; $test -lt 26; $test++)
|
for ($test = 0; $test -lt 26; $test++)
|
||||||
{
|
{
|
||||||
$DiskDriveLetter = ([char](65 + $test))
|
$DiskDriveLetter = ([char](65 + $test))
|
||||||
|
|
@ -211,12 +227,14 @@ function Get-IcingaDiskTotalSectors
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-IcingaDisks {
|
function Get-IcingaDisks {
|
||||||
|
<# Collects all the most important Disk-Informations,
|
||||||
|
e.g. size, model, sectors, cylinders
|
||||||
|
Is dependent on Get-IcingaDiskPartitions#>
|
||||||
$DiskInformation = Get-CimInstance Win32_DiskDrive;
|
$DiskInformation = Get-CimInstance Win32_DiskDrive;
|
||||||
$diskPartitionInformation = Get-IcingaDiskPartitions;
|
$diskPartitionInformation = Get-IcingaDiskPartitions;
|
||||||
[hashtable]$DiskData = @{};
|
[hashtable]$DiskData = @{};
|
||||||
|
|
||||||
foreach ($id in $DiskInformation.DeviceID) {
|
foreach ($id in $DiskInformation.DeviceID) {
|
||||||
[int]$id = $id.trimstart(".\PHYSICALDRVE");
|
[int]$id = $id.trimstart(".\PHYSICALDRVE");
|
||||||
|
|
||||||
$DiskData.Add(
|
$DiskData.Add(
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
[hashtable]$BiosCharacteristics = @{
|
|
||||||
|
<##################################################################################################
|
||||||
|
################# /lib/provider/bios.psm1 #########################################################
|
||||||
|
##################################################################################################>
|
||||||
|
|
||||||
|
[hashtable]$BiosCharacteristics = @{
|
||||||
0 = 'Reserved';
|
0 = 'Reserved';
|
||||||
1 = 'Reserved';
|
1 = 'Reserved';
|
||||||
2 = 'Unknown';
|
2 = 'Unknown';
|
||||||
3 = 'BIOS Characteristics Not Supported';
|
3 = 'BIOS Characteristics Not Supported';
|
||||||
4 = 'ISA is supported';
|
4 = 'ISA is supported';
|
||||||
5 = 'MCA is supported';
|
5 = 'MCA is supported';
|
||||||
6 = 'EISA is supported';
|
6 = 'EISA is supported';
|
||||||
|
|
@ -65,7 +70,11 @@
|
||||||
63 = 'Reserved for system vendor'
|
63 = 'Reserved for system vendor'
|
||||||
}
|
}
|
||||||
|
|
||||||
[hashtable]$DiskCapabilities = @{
|
<##################################################################################################
|
||||||
|
################# /lib/provider/disks.psm1 ########################################################
|
||||||
|
##################################################################################################>
|
||||||
|
|
||||||
|
[hashtable]$DiskCapabilities = @{
|
||||||
0 = 'Unknown';
|
0 = 'Unknown';
|
||||||
1 = 'Other';
|
1 = 'Other';
|
||||||
2 = 'Sequential Access';
|
2 = 'Sequential Access';
|
||||||
|
|
@ -78,9 +87,13 @@
|
||||||
9 = 'Automatic Cleaning';
|
9 = 'Automatic Cleaning';
|
||||||
10 = 'SMART Notification';
|
10 = 'SMART Notification';
|
||||||
11 = 'Supports Dual Sided Media';
|
11 = 'Supports Dual Sided Media';
|
||||||
12 = 'Predismount Eject Not Required'
|
12 = 'Predismount Eject Not Required';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<##################################################################################################
|
||||||
|
################# /lib/provider/cpu.psm1 ##########################################################
|
||||||
|
##################################################################################################>
|
||||||
|
|
||||||
[hashtable]$CPUArchitecture = @{
|
[hashtable]$CPUArchitecture = @{
|
||||||
0='x86';
|
0='x86';
|
||||||
1='MIPS';
|
1='MIPS';
|
||||||
|
|
@ -100,122 +113,122 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
[hashtable]$CPUStatusInfo = @{
|
[hashtable]$CPUStatusInfo = @{
|
||||||
1='Other'
|
1='Other';
|
||||||
2='Unknown'
|
2='Unknown';
|
||||||
3='Enabled'
|
3='Enabled';
|
||||||
4='Disabled'
|
4='Disabled';
|
||||||
5='Not Applicable'
|
5='Not Applicable';
|
||||||
}
|
}
|
||||||
|
|
||||||
[hashtable]$CPUFamily = @{
|
[hashtable]$CPUFamily = @{
|
||||||
1='Other'
|
1='Other';
|
||||||
2='Unknown'
|
2='Unknown';
|
||||||
3='8086'
|
3='8086';
|
||||||
4='80286'
|
4='80286';
|
||||||
5='80386'
|
5='80386';
|
||||||
6='80486'
|
6='80486';
|
||||||
7='8087'
|
7='8087';
|
||||||
8='80287'
|
8='80287';
|
||||||
9='80387'
|
9='80387';
|
||||||
10='80487'
|
10='80487';
|
||||||
11='Pentium(R) brand'
|
11='Pentium(R) brand';
|
||||||
12='Pentium(R) Pro'
|
12='Pentium(R) Pro';
|
||||||
13='Pentium(R) II'
|
13='Pentium(R) II';
|
||||||
14='Pentium(R) processor with MMX(TM) technology'
|
14='Pentium(R) processor with MMX(TM) technology';
|
||||||
15='Celeron(TM)'
|
15='Celeron(TM)';
|
||||||
16='Pentium(R) II Xeon(TM)'
|
16='Pentium(R) II Xeon(TM)';
|
||||||
17='Pentium(R) III'
|
17='Pentium(R) III';
|
||||||
18='M1 Family'
|
18='M1 Family';
|
||||||
19='M2 Family'
|
19='M2 Family';
|
||||||
24='K5 Family'
|
24='K5 Family';
|
||||||
25='K6 Family'
|
25='K6 Family';
|
||||||
26='K6-2'
|
26='K6-2';
|
||||||
27='K6-3'
|
27='K6-3';
|
||||||
28='AMD Athlon(TM) Processor Family'
|
28='AMD Athlon(TM) Processor Family';
|
||||||
29='AMD(R) Duron(TM) Processor'
|
29='AMD(R) Duron(TM) Processor';
|
||||||
30='AMD29000 Family'
|
30='AMD29000 Family';
|
||||||
31='K6-2+'
|
31='K6-2+';
|
||||||
32='Power PC Family'
|
32='Power PC Family';
|
||||||
33='Power PC 601'
|
33='Power PC 601';
|
||||||
34='Power PC 603'
|
34='Power PC 603';
|
||||||
35='Power PC 603+'
|
35='Power PC 603+';
|
||||||
36='Power PC 604'
|
36='Power PC 604';
|
||||||
37='Power PC 620'
|
37='Power PC 620';
|
||||||
38='Power PC X704'
|
38='Power PC X704';
|
||||||
39='Power PC 750'
|
39='Power PC 750';
|
||||||
48='Alpha Family'
|
48='Alpha Family';
|
||||||
49='Alpha 21064'
|
49='Alpha 21064';
|
||||||
50='Alpha 21066'
|
50='Alpha 21066';
|
||||||
51='Alpha 21164'
|
51='Alpha 21164';
|
||||||
52='Alpha 21164PC'
|
52='Alpha 21164PC';
|
||||||
53='Alpha 21164a'
|
53='Alpha 21164a';
|
||||||
54='Alpha 21264'
|
54='Alpha 21264';
|
||||||
55='Alpha 21364'
|
55='Alpha 21364';
|
||||||
64='MIPS Family'
|
64='MIPS Family';
|
||||||
65='MIPS R4000'
|
65='MIPS R4000';
|
||||||
66='MIPS R4200'
|
66='MIPS R4200';
|
||||||
67='MIPS R4400'
|
67='MIPS R4400';
|
||||||
68='MIPS R4600'
|
68='MIPS R4600';
|
||||||
69='MIPS R10000'
|
69='MIPS R10000';
|
||||||
80='SPARC Family'
|
80='SPARC Family';
|
||||||
81='SuperSPARC'
|
81='SuperSPARC';
|
||||||
82='microSPARC II'
|
82='microSPARC II';
|
||||||
83='microSPARC IIep'
|
83='microSPARC IIep';
|
||||||
84='UltraSPARC'
|
84='UltraSPARC';
|
||||||
85='UltraSPARC II'
|
85='UltraSPARC II';
|
||||||
86='UltraSPARC IIi'
|
86='UltraSPARC IIi';
|
||||||
87='UltraSPARC III'
|
87='UltraSPARC III';
|
||||||
88='UltraSPARC IIIi'
|
88='UltraSPARC IIIi';
|
||||||
96='68040'
|
96='68040';
|
||||||
97='68xxx Family'
|
97='68xxx Family';
|
||||||
98='68000'
|
98='68000';
|
||||||
99='68010'
|
99='68010';
|
||||||
100='68020'
|
100='68020';
|
||||||
101='68030'
|
101='68030';
|
||||||
112='Hobbit Family'
|
112='Hobbit Family';
|
||||||
120='Crusoe(TM) TM5000 Family'
|
120='Crusoe(TM) TM5000 Family';
|
||||||
121='Crusoe(TM) TM3000 Family'
|
121='Crusoe(TM) TM3000 Family';
|
||||||
122='Efficeon(TM) TM8000 Family'
|
122='Efficeon(TM) TM8000 Family';
|
||||||
128='Weitek'
|
128='Weitek';
|
||||||
130='Itanium(TM) Processor'
|
130='Itanium(TM) Processor';
|
||||||
131='AMD Athlon(TM) 64 Processor Family'
|
131='AMD Athlon(TM) 64 Processor Family';
|
||||||
132='AMD Opteron(TM) Family'
|
132='AMD Opteron(TM) Family';
|
||||||
144='PA-RISC Family'
|
144='PA-RISC Family';
|
||||||
145='PA-RISC 8500'
|
145='PA-RISC 8500';
|
||||||
146='PA-RISC 8000'
|
146='PA-RISC 8000';
|
||||||
147='PA-RISC 7300LC'
|
147='PA-RISC 7300LC';
|
||||||
148='PA-RISC 7200'
|
148='PA-RISC 7200';
|
||||||
149='PA-RISC 7100LC'
|
149='PA-RISC 7100LC';
|
||||||
150='PA-RISC 7100'
|
150='PA-RISC 7100';
|
||||||
160='V30 Family'
|
160='V30 Family';
|
||||||
176='Pentium(R) III Xeon(TM)'
|
176='Pentium(R) III Xeon(TM)';
|
||||||
177='Pentium(R) III Processor with Intel(R) SpeedStep(TM) Technology'
|
177='Pentium(R) III Processor with Intel(R) SpeedStep(TM) Technology';
|
||||||
178='Pentium(R) 4'
|
178='Pentium(R) 4';
|
||||||
179='Intel(R) Xeon(TM)'
|
179='Intel(R) Xeon(TM)';
|
||||||
180='AS400 Family'
|
180='AS400 Family';
|
||||||
181='Intel(R) Xeon(TM) processor MP'
|
181='Intel(R) Xeon(TM) processor MP';
|
||||||
182='AMD AthlonXP(TM) Family'
|
182='AMD AthlonXP(TM) Family';
|
||||||
183='AMD AthlonMP(TM) Family'
|
183='AMD AthlonMP(TM) Family';
|
||||||
184='Intel(R) Itanium(R) 2'
|
184='Intel(R) Itanium(R) 2';
|
||||||
185='Intel Pentium M Processor'
|
185='Intel Pentium M Processor';
|
||||||
190='K7'
|
190='K7';
|
||||||
200='IBM390 Family'
|
200='IBM390 Family';
|
||||||
201='G4'
|
201='G4';
|
||||||
202='G5'
|
202='G5';
|
||||||
203='G6'
|
203='G6';
|
||||||
204='z/Architecture base'
|
204='z/Architecture base';
|
||||||
250='i860'
|
250='i860';
|
||||||
251='i960'
|
251='i960';
|
||||||
260='SH-3'
|
260='SH-3';
|
||||||
261='SH-4'
|
261='SH-4';
|
||||||
280='ARM'
|
280='ARM';
|
||||||
281='StrongARM'
|
281='StrongARM';
|
||||||
300='6x86'
|
300='6x86';
|
||||||
301='MediaGX'
|
301='MediaGX';
|
||||||
302='MII'
|
302='MII';
|
||||||
320='WinChip'
|
320='WinChip';
|
||||||
350='DSP'
|
350='DSP';
|
||||||
500='Video Processor'
|
500='Video Processor';
|
||||||
}
|
}
|
||||||
|
|
||||||
[hashtable]$CPUConfigManagerErrorCode = @{
|
[hashtable]$CPUConfigManagerErrorCode = @{
|
||||||
|
|
@ -277,15 +290,109 @@
|
||||||
21='Quiesced';
|
21='Quiesced';
|
||||||
}
|
}
|
||||||
|
|
||||||
[hashtable]$ProviderEnums = @{
|
[hashtable]$CPUPowerManagementCapabilities = @{
|
||||||
|
0='Unknown';
|
||||||
|
1='Not Supported';
|
||||||
|
2='Disabled';
|
||||||
|
3='Enabled';
|
||||||
|
}
|
||||||
|
|
||||||
|
[hashtable]$MemoryFormFactor = @{
|
||||||
|
0='Unknown';
|
||||||
|
1= 'Other';
|
||||||
|
2= 'SIP';
|
||||||
|
3= 'DIP';
|
||||||
|
4= 'ZIP';
|
||||||
|
5= 'SOJ';
|
||||||
|
6= 'Proprietary';
|
||||||
|
7= 'SIMM';
|
||||||
|
8= 'DIMM';
|
||||||
|
9= 'TSOP';
|
||||||
|
10= 'PGA';
|
||||||
|
11= 'RIMM';
|
||||||
|
12= 'SODIMM';
|
||||||
|
13= 'SRIMM';
|
||||||
|
14= 'SMD';
|
||||||
|
15= 'SSMP';
|
||||||
|
16= 'QFP';
|
||||||
|
17= 'TQFP';
|
||||||
|
18= 'SOIC';
|
||||||
|
19= 'LCC';
|
||||||
|
20= 'PLCC';
|
||||||
|
21= 'BGA';
|
||||||
|
22= 'FPBGA';
|
||||||
|
23= 'LGA';
|
||||||
|
}
|
||||||
|
|
||||||
|
[hashtable]$MemoryInterleavePosition = @{
|
||||||
|
0= 'Noninterleaved';
|
||||||
|
1= 'First position';
|
||||||
|
2= 'Second position';
|
||||||
|
}
|
||||||
|
|
||||||
|
[hashtable]$MemoryMemoryType = @{
|
||||||
|
0= 'Unknown';
|
||||||
|
1= 'Other';
|
||||||
|
2= 'DRAM';
|
||||||
|
3= 'Synchronous DRAM';
|
||||||
|
4= 'Cache DRAM';
|
||||||
|
5= 'EDO';
|
||||||
|
6= 'EDRAM';
|
||||||
|
7= 'VRAM';
|
||||||
|
8= 'SRAM';
|
||||||
|
9= 'RAM';
|
||||||
|
10= 'ROM';
|
||||||
|
11= 'Flash';
|
||||||
|
12='EEPROM';
|
||||||
|
13= 'FEPROM';
|
||||||
|
14= 'EPROM';
|
||||||
|
15= 'CDRAM';
|
||||||
|
16= '3DRAM';
|
||||||
|
17= 'SDRAM';
|
||||||
|
18= 'SGRAM';
|
||||||
|
19= 'RDRAM';
|
||||||
|
20= 'DDR';
|
||||||
|
21= 'DDR2';
|
||||||
|
22= 'DDR2 FB-DIMM';
|
||||||
|
23= 'DDR2—FB-DIMM,May not be available; see note above.';
|
||||||
|
24= 'DDR3—May not be available; see note above.';
|
||||||
|
25= 'FBD2';
|
||||||
|
}
|
||||||
|
|
||||||
|
[hashtable]$MemoryTypeDetail = @{
|
||||||
|
1= 'Reserved';
|
||||||
|
2= 'Other';
|
||||||
|
4= 'Unknown';
|
||||||
|
8= 'Fast-paged';
|
||||||
|
16= 'Static column';
|
||||||
|
32= 'Pseudo-static';
|
||||||
|
64= 'RAMBUS';
|
||||||
|
128= 'Synchronous';
|
||||||
|
256= 'CMOS';
|
||||||
|
512= 'EDO';
|
||||||
|
1024= 'Window DRAM';
|
||||||
|
2048= 'Cache DRAM';
|
||||||
|
4096= 'Non-volatile';
|
||||||
|
}
|
||||||
|
|
||||||
|
[hashtable]$ProviderEnums = @{
|
||||||
|
#/lib/provider/bios.psm1
|
||||||
BiosCharacteristics = $BiosCharacteristics;
|
BiosCharacteristics = $BiosCharacteristics;
|
||||||
|
#/lib/provider/disks.psm1
|
||||||
DiskCapabilities = $DiskCapabilities;
|
DiskCapabilities = $DiskCapabilities;
|
||||||
|
#/lib/provider/cpu.psm1
|
||||||
CPUArchitecture = $CPUArchitecture;
|
CPUArchitecture = $CPUArchitecture;
|
||||||
CPUProcessorType = $CPUProcessorType;
|
CPUProcessorType = $CPUProcessorType;
|
||||||
CPUStatusInfo = $CPUStatusInfo;
|
CPUStatusInfo = $CPUStatusInfo;
|
||||||
CPUFamily = $CPUFamily;
|
CPUFamily = $CPUFamily;
|
||||||
CPUConfigManagerErrorCode = $CPUConfigManagerErrorCode;
|
CPUConfigManagerErrorCode = $CPUConfigManagerErrorCode;
|
||||||
CPUAvailability = $CPUAvailability;
|
CPUAvailability = $CPUAvailability;
|
||||||
|
CPUPowerManagementCapabilities = $CPUPowerManagementCapabilities;
|
||||||
|
#/lib/provider/memory.psm1
|
||||||
|
MemoryFormFactor = $MemoryFormFactor;
|
||||||
|
MemoryInterleavePosition = $MemoryInterleavePosition;
|
||||||
|
MemoryMemoryType = $MemoryMemoryType;
|
||||||
|
MemoryTypeDetail = $MemoryTypeDetail;
|
||||||
}
|
}
|
||||||
|
|
||||||
Export-ModuleMember -Variable @('ProviderEnums');
|
Export-ModuleMember -Variable @('ProviderEnums');
|
||||||
196
lib/provider/memory.psm1
Normal file
196
lib/provider/memory.psm1
Normal file
|
|
@ -0,0 +1,196 @@
|
||||||
|
Import-Module $IncludeDir\provider\enums;
|
||||||
|
|
||||||
|
<##################################################################################################
|
||||||
|
################# Runspace "Show-Icinga{Memory}" ##################################################
|
||||||
|
##################################################################################################>
|
||||||
|
function Show-IcingaMemoryData ()
|
||||||
|
{
|
||||||
|
|
||||||
|
$MEMInformation = Get-CimInstance Win32_PhysicalMemory;
|
||||||
|
|
||||||
|
[hashtable]$MEMData = @{};
|
||||||
|
|
||||||
|
foreach($id in $MEMInformation) {
|
||||||
|
$MEMData.Add(
|
||||||
|
$id.tag.trim("Physical Memory"), @{
|
||||||
|
'Caption' = $id.Name;
|
||||||
|
'Description' = $id.Description;
|
||||||
|
'Name' = $id.Name;
|
||||||
|
'InstallDate' = $id.InstallDate;
|
||||||
|
'Status' = $id.Status
|
||||||
|
'CreationClassName'= $id.CreationClassName
|
||||||
|
'Manufacturer'= $id.Manufacturer
|
||||||
|
'Model'= $id.Model
|
||||||
|
'OtherIdentifyingInfo'= $id.OtherIdentifyingInfo
|
||||||
|
'PartNumber'= $id.PartNumber
|
||||||
|
'PoweredOn'= $id.PoweredOn
|
||||||
|
'SerialNumber'= $id.SerialNumber
|
||||||
|
'SKU'= $id.SKU
|
||||||
|
'Tag'= $id.Tag
|
||||||
|
'Version'= $id.Version
|
||||||
|
'HotSwappable'= $id.HotSwappable
|
||||||
|
'Removable'= $id.Removable
|
||||||
|
'Replaceable'= $id.Replaceable
|
||||||
|
'FormFactor'= $id.FormFactor
|
||||||
|
'BankLabel'= $id.BankLabel
|
||||||
|
'Capacity'= $id.Capacity
|
||||||
|
'DataWidth'= $id.DataWidth
|
||||||
|
'InterleavePosition'= $id.InterleavePosition
|
||||||
|
'MemoryType'= $id.MemoryType
|
||||||
|
'PositionInRow'= $id.PositionInRow
|
||||||
|
'Speed'= $id.Speed
|
||||||
|
'TotalWidth'= $id.TotalWidth
|
||||||
|
'Attributes'= $id.Attributes
|
||||||
|
'ConfiguredClockSpeed'= $id.ConfiguredClockSpeed
|
||||||
|
'ConfiguredVoltage'= $id.ConfiguredVoltage
|
||||||
|
'DeviceLocator'= $id.DeviceLocator
|
||||||
|
'InterleaveDataDepth'= $id.InterleaveDataDepth
|
||||||
|
'MaxVoltage'= $id.MaxVoltage
|
||||||
|
'MinVoltage'= $id.MinVoltage
|
||||||
|
'SMBIOSMemoryType'= $id.SMBIOSMemoryType
|
||||||
|
'TypeDetail'= $id.TypeDetail
|
||||||
|
'PSComputerName'= $id.PSComputerName
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $MEMData;
|
||||||
|
}
|
||||||
|
<##################################################################################################
|
||||||
|
################# Runspace "Get-Icinga{Memory}" ###################################################
|
||||||
|
##################################################################################################>
|
||||||
|
function Get-IcingaMemory ()
|
||||||
|
{
|
||||||
|
<# Collects the most important Memory informations,
|
||||||
|
e.g. name, version, manufacturer#>
|
||||||
|
$MEMInformation = Get-CimInstance Win32_PhysicalMemory;
|
||||||
|
|
||||||
|
[hashtable]$MEMData = @{};
|
||||||
|
|
||||||
|
foreach($id in $MEMInformation) {
|
||||||
|
$MEMData.Add(
|
||||||
|
$id.tag.trim("Physical Memory"), @{
|
||||||
|
'metadata' = @{
|
||||||
|
'Caption' = $id.Name;
|
||||||
|
'Description'= $id.Description;
|
||||||
|
'Manufacturer'= $id.Manufacturer;
|
||||||
|
'Model'= $id.Model;
|
||||||
|
'OtherIdentifyingInfo'= $id.OtherIdentifyingInfo;
|
||||||
|
'PartNumber'= $id.PartNumber;
|
||||||
|
'SerialNumber'= $id.SerialNumber;
|
||||||
|
'Tag'= $id.Tag;
|
||||||
|
'SMBIOSMemoryType'= $id.SMBIOSMemoryType;
|
||||||
|
'DeviceLocator' = $id.DeviceLocator;
|
||||||
|
'PositionInRow' = $id.PositionInRow;
|
||||||
|
'Version' = $id.Version;
|
||||||
|
'PoweredOn' = $id.PoweredOn;
|
||||||
|
'Status' = $id.Status;
|
||||||
|
'InstallDate' = $id.InstallDate;
|
||||||
|
'BankLabel' = $id.BankLabel;
|
||||||
|
'InterleaveDataDepth' = $id.InterleaveDataDepth;
|
||||||
|
'Attributes' = $id.Attributes;
|
||||||
|
'Replaceable' = $id.Replaceable;
|
||||||
|
'Removable' = $id.Removable;
|
||||||
|
'HotSwappable' = $id.HotSwappable;
|
||||||
|
'FormFactor' = @{
|
||||||
|
'raw' = $id.FormFactor;
|
||||||
|
'value' = $ProviderEnums.MemoryFormFactor[[int]$id.FormFactor];
|
||||||
|
};
|
||||||
|
'InterleavePosition' = @{
|
||||||
|
'raw' = $id.InterleavePosition;
|
||||||
|
'value' = $ProviderEnums.MemoryInterleavePosition[[int]$id.InterleavePosition];
|
||||||
|
};
|
||||||
|
'MemoryType' = @{
|
||||||
|
'raw' = $id.MemoryType;
|
||||||
|
'value' = $ProviderEnums.MemoryMemoryType[[int]$id.MemoryType];
|
||||||
|
};
|
||||||
|
'TypeDetail' = @{
|
||||||
|
'raw' = $id.TypeDetail;
|
||||||
|
'value' = $ProviderEnums.MemoryTypeDetail[[int]$id.TypeDetail];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
'specs' = @{
|
||||||
|
'MaxVoltage' = $id.MaxVoltage;
|
||||||
|
'MinVoltage' = $id.MinVoltage;
|
||||||
|
'ConfiguredVoltage' = $id.ConfiguredVoltage;
|
||||||
|
'ConfiguredClockSpeed' = $id.ConfiguredClockSpeed;
|
||||||
|
'TotalWidth' = $id.TotalWidth;
|
||||||
|
'DataWidth' = $id.DataWidth;
|
||||||
|
'Speed' = $id.Speed;
|
||||||
|
'Capacity' = $id.Capacity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $MEMData;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaMemoryInformation()
|
||||||
|
{
|
||||||
|
param(
|
||||||
|
[string]$Parameter
|
||||||
|
);
|
||||||
|
$MEMInformation = Get-CimInstance Win32_PhysicalMemory;
|
||||||
|
[hashtable]$MEMData = @{};
|
||||||
|
|
||||||
|
foreach ($id in $MEMInformation) {
|
||||||
|
$MEMData.Add($id.tag.trim("Physical Memory"), $id.$Parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $MEMData;
|
||||||
|
}
|
||||||
|
function Get-IcingaMemoryMaxVoltage()
|
||||||
|
{
|
||||||
|
$MemoryMaxVoltage = Get-IcingaMemoryInformation -Parameter MaxVoltage;
|
||||||
|
|
||||||
|
return @{'value' = $MemoryMaxVoltage; 'name' = 'MaxVoltage'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaMemoryMinVoltage()
|
||||||
|
{
|
||||||
|
$MemoryMinVoltage = Get-IcingaMemoryInformation -Parameter MinVoltage;
|
||||||
|
|
||||||
|
return @{'value' = $MemoryMinVoltage; 'name' = 'MinVoltage'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaMemoryConfiguredVoltage()
|
||||||
|
{
|
||||||
|
$MemoryConfiguredVoltage = Get-IcingaMemoryInformation -Parameter ConfiguredVoltage;
|
||||||
|
|
||||||
|
return @{'value' = $MemoryConfiguredVoltage; 'name' = 'ConfiguredVoltage'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaMemoryConfiguredClockSpeed()
|
||||||
|
{
|
||||||
|
$MemoryConfiguredClockSpeed = Get-IcingaMemoryInformation -Parameter ConfiguredClockSpeed;
|
||||||
|
|
||||||
|
return @{'value' = $MemoryConfiguredClockSpeed; 'name' = 'ConfiguredClockSpeed'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaMemoryTotalWidth()
|
||||||
|
{
|
||||||
|
$MemoryTotalWidth = Get-IcingaMemoryInformation -Parameter TotalWidth;
|
||||||
|
|
||||||
|
return @{'value' = $MemoryTotalWidth; 'name' = 'TotalWidth'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaMemoryDataWidth()
|
||||||
|
{
|
||||||
|
$MemoryDataWidth = Get-IcingaMemoryInformation -Parameter DataWidth;
|
||||||
|
|
||||||
|
return @{'value' = $MemoryDataWidth; 'name' = 'DataWidth'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaMemorySpeed()
|
||||||
|
{
|
||||||
|
$MemorySpeed = Get-IcingaMemoryInformation -Parameter Speed;
|
||||||
|
|
||||||
|
return @{'value' = $MemorySpeed; 'name' = 'Speed'};
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-IcingaMemoryCapacity()
|
||||||
|
{
|
||||||
|
$MemoryCapacity = Get-IcingaMemoryInformation -Parameter Capacity;
|
||||||
|
|
||||||
|
return @{'value' = $MemoryCapacity; 'name' = 'Capacity'};
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue