2 Replies Latest reply on May 7, 2009 8:43 PM by adamd2929

    How to Monitor Virtual Memory?

      I can monitor memory and hard disk usage with the built in Monitors in ipMonitor.

      Is there a probe that will monitor Virtual Memory?

      I could create a custom SNMP probe on 1.3.6.1.2.1.25.2.3.1.6.5 (VM free) and check the value is less than 48959 (at least 64MB free - if my math is right).

      But the problem is that the OID will be different on each server; and could change in the example below, if I unmapped drive Y: or modified the system by plugging in a USB drive :(

      What I would like is a monitor that finds the entry in the hrStorage table that relates to the hrStorageVirtualMemory entry.

       

        • Re: How to Monitor Virtual Memory?
          Fodome

          Hello adamd2929,

          One way around this would be to use the External Process Monitor with a script to monitor the TotalVirtualMemory.  A script is available here that might give you what you need:

          Monitoring Total Virtual Memory Size on a Windows system

          Feel free to customize the script to meet your needs.  It also includes a readme file explaining how to call it from the External Process Monitor.

          Hope this helps.

          Chris Foley - SolarWinds - Support Specialist
          Support:  866.530.8040  |  Fax: 512.857.0125
          network management simplified  |  solarwinds.com

            • Re: How to Monitor Virtual Memory?

              Thank you for the script.

              I have modified it to measure free virtual memory and use a percentage (make my life easier):

              ' Usage: cscript.exe Virtual_MemCheck.vbs [REMOTESRV] [THRESHOLD]
              '        [REMOTESRV]    NetBIOS, FQDN or IP address to Remote server
              '        [THRESHOLD]    Minimum percent Free Virtual Memory


              Option Explicit

              Const THRESHOLD_EXCEEDED = 1, PASS = 0, INVALID_PARAMS = -1, OBJECT_NOT_INITIALIZED = -2

                Dim lstArgs, REMOTESRV, THRESHOLD, objWMIService, resultSetSWbemObject, element

                Set lstArgs = WScript.Arguments

                If lstArgs.Count = 2 Then
                   REMOTESRV      = Trim( lstArgs( 0 ))
                   THRESHOLD    = Trim( lstArgs( 1 ))
                Else
                   WScript.Echo " Usage: cscript.exe Virtual_MemCheck.vbs [REMOTESRV] [THRESHOLD]"
                   WScript.Echo vbTAB & "[REMOTESRV]    NetBIOS, FQDN or IP address to Remote server"
                   WScript.Echo vbTAB & "[THRESHOLD]    Percent Free Virtual Memory"
                   WScript.Quit( INVALID_PARAMS )
                End If

              Set objWMIService = GetObject("winmgmts:\\" & REMOTESRV & "\root\CIMV2")

                        If( IsEmpty( objWMIService ) = True ) Then
                          WScript.Echo( "OBJECT_NOT_INITIALIZED :: WMI ResultSet " )
                          WScript.Quit( OBJECT_NOT_INITIALIZED )
                        End If

              Set resultSetSWbemObject= objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")

                  For Each element In resultSetSWbemObject

                        WScript.Echo( "Free Virtual Memory Size in KBytes: " & element.FreeVirtualMemory )
                        WScript.Echo( "Total Virtual Memory Size in KBytes: " & element.TotalVirtualMemorySize )
                        WScript.Echo( "Virtual Memory Free %: " & 100*element.FreeVirtualMemory/element.TotalVirtualMemorySize )
                        WScript.Echo( "Threshold %: " & THRESHOLD )

                        If( CDbl( 100*element.FreeVirtualMemory/element.TotalVirtualMemorySize ) >= CDbl( THRESHOLD )) Then
                          WScript.Echo( "Threshold not exceeded" )
                          WScript.Quit( PASS )
                        Else
                          WScript.Echo( "THRESHOLD EXCEEDED" )
                          WScript.Quit( THRESHOLD_EXCEEDED )
                        End If
                  Next

               

              The script works on my Windows 2003 server with 2.5GB of virtual memory (1GB Physical + 1.5GB Page File = 2.5GB)

              D:\>cscript virtual_memcheck.vbs localhost 10
              Microsoft (R) Windows Script Host Version 5.6
              Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

              Free Virtual Memory Size in KBytes: 2149824
              Total Virtual Memory Size in KBytes: 2532904
              Virtual Memory Free %: 84.8758579085508
              Threshold %: 10
              Threshold not exceeded

              D:\>cscript virtual_memcheck.vbs localhost 90
              Microsoft (R) Windows Script Host Version 5.6
              Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

              Free Virtual Memory Size in KBytes: 2125196
              Total Virtual Memory Size in KBytes: 2532904
              Virtual Memory Free %: 83.9035352307075
              Threshold %: 90
              THRESHOLD EXCEEDED

              But on my Windows XP desktop it does not work (3.5GB Physical + 7GB Page File = 10GB) (Note that 3.5GB is the amount of memory available to Windows, the other 512MB has been taken by the video adapter).

              C:\>cscript virtual_memcheck.vbs localhost 10
              Microsoft (R) Windows Script Host Version 5.6
              Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

              Free Virtual Memory Size in KBytes: 2055592
              Total Virtual Memory Size in KBytes: 2097024
              Virtual Memory Free %: 98.0242476957822
              Threshold %: 10
              Threshold not exceeded

              Note the total virtual memory is really 10GB not the 2GB reported by WMI.  The free VM should be at least 8GB.

              I don't think that the numbers from WMI are accurate enough to use in monitoring.