icinga-powershell-plugins icon indicating copy to clipboard operation
icinga-powershell-plugins copied to clipboard

Invoke-IcingaCheckMemory Pagefile Percent Warning and Critical Threshold still not working

Open audiocoach opened this issue 1 year ago • 5 comments
trafficstars

According to #367 and #363 this was fixed in 1.11.1 but it is still not working

image

image

Icinga 2.14.1 Icinga Web 2.12.1 Icinga Director 1.11 Icinga for Windows 1.11.1

audiocoach avatar Jan 10 '24 11:01 audiocoach

Hm, can't confirm. image image

fresh installation of framework & plugins v1.11.1 and icinga agent v2.14.0

log1-c avatar Jan 19 '24 14:01 log1-c

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.

image

audiocoach avatar Jan 20 '24 20:01 audiocoach

Have you tried specifically including the pagefile via parameter? Maybe that helps.

log1-c avatar Jan 22 '24 08:01 log1-c

Yes. Unfortunatley the problem persists.

audiocoach avatar Jan 22 '24 15:01 audiocoach

``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;
        }

audiocoach avatar Mar 19 '24 15:03 audiocoach