2019-07-25 12:29:21 -04:00
|
|
|
function Get-IcingaMemoryPerformanceCounter()
|
|
|
|
|
{
|
2019-10-30 03:37:24 -04:00
|
|
|
$MemoryPercent = New-IcingaPerformanceCounterArray -Counter "\Memory\% committed bytes in use","\Memory\committed bytes","\Paging File(_Total)\% usage"
|
2019-07-25 12:29:21 -04:00
|
|
|
[hashtable]$Result = @{};
|
|
|
|
|
|
2019-10-30 03:37:24 -04:00
|
|
|
foreach ($item in $MemoryPercent.Keys) {
|
|
|
|
|
$Result.Add($item, $MemoryPercent[$item]);
|
2019-07-25 12:29:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $Result;
|
|
|
|
|
}
|
2019-10-29 11:39:44 -04:00
|
|
|
|
2019-10-30 03:37:24 -04:00
|
|
|
function Get-IcingaMemoryPerformanceCounterFormated()
|
2019-10-29 11:39:44 -04:00
|
|
|
{
|
|
|
|
|
[hashtable]$Result = @{};
|
2019-10-30 03:37:24 -04:00
|
|
|
$Result.Add('Memory %', (Get-IcingaMemoryPerformanceCounter).'\Memory\% committed bytes in use'.value);
|
|
|
|
|
$Result.Add('Memory GigaByte', (ConvertTo-GigaByte ([decimal](Get-IcingaMemoryPerformanceCounter).'\Memory\committed bytes'.value) -Unit Byte));
|
|
|
|
|
$Result.Add('PageFile %', (Get-IcingaMemoryPerformanceCounter).'\Paging File(_Total)\% usage'.value);
|
|
|
|
|
|
2019-10-29 11:39:44 -04:00
|
|
|
return $Result;
|
|
|
|
|
}
|