I have a VBScript that finds the % memory in use, but I'm not sure how to create it as a custom metric to monitor?
here is the script:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colSettings
'Wscript.Echo "Total Physical Memory: " & _
'objComputer.TotalPhysicalMemory
dim TotMemByte
TotMemByte = objComputer.TotalPhysicalMemory
dim TotMem
TotMem = TotMemByte / 1048576
Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colSettings
'Wscript.Echo "Available Physical Memory: " & _
'objOperatingSystem.FreePhysicalMemory
dim FreeMemMeg
FreeMemMeg = objOperatingSystem.FreePhysicalMemory
dim FreeMem
FreeMem = FreeMemMeg / 1024
Next
dim c
c = FreeMem / TotMem * 100
dim d
d = round(c)
dim f
f = 100 - d
wscript.echo f & "%"
wscript.quit
Any Ideas?