icinga-powershell-plugins
icinga-powershell-plugins copied to clipboard
Invoke-IcingaCheckMemory Pagefile Percent Warning and Critical Threshold still not working
According to #367 and #363 this was fixed in 1.11.1 but it is still not working
Icinga 2.14.1 Icinga Web 2.12.1 Icinga Director 1.11 Icinga for Windows 1.11.1
Hm, can't confirm.
fresh installation of framework & plugins v1.11.1 and icinga agent v2.14.0
Ok, I think I have found the problem. It has to do with the pagefile settings. If you set the pagefile to system managed for all disks it works as expected. But if you set the pagefile for each drive manually the threshold percentage is calculated wrong. In my case I have the pagefile on a separate drive because for hyper-v replication it is recommended to put the pagefile on a separate drive which is excluded from the replication.
Have you tried specifically including the pagefile via parameter? Maybe that helps.
Yes. Unfortunatley the problem persists.
``I think, I found a solution. The problem is that when you disable the "manage pagefile for all disks automatically" in the windows settings gui the pagefile is considered manual managed even if you set that the size should be automatically managed like in my screenshot above. My solution looks as follows:
Replace lines 60 -71 in the Get-IcingaMemoryPerformanceCounter.psm1 (located at C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-plugins\provider\memory)
Original Code:
$MemoryData.PageFile.Add(
$entry.Name,
@{
'InitialSize' = $entry.InitialSize * 1024 * 1024;
'Managed' = $TRUE;
'Name' = $entry.Name;
'TotalSize' = $entry.MaximumSize * 1024 * 1024;
}
);
$MemoryData['PageFile Total Bytes'] += $entry.MaximumSize * 1024 * 1024;
$MemoryData['PageFile Used Bytes'] += $entry.InitialSize * 1024 * 1024;
Solution Code:
if ($entry.MaximumSize -ne 0) {
$MemoryData.PageFile.Add(
$entry.Name,
@{
'InitialSize' = $entry.InitialSize * 1024 * 1024;
'Managed' = $TRUE;
'Name' = $entry.Name;
'TotalSize' = $entry.MaximumSize * 1024 * 1024;
}
);
$MemoryData['PageFile Total Bytes'] += $entry.MaximumSize * 1024 * 1024;
$MemoryData['PageFile Used Bytes'] += $entry.InitialSize * 1024 * 1024;
}