사용 중인 메모리 수집 규칙 (VBS) - SCOM 2007 SystemCenter2009. 3. 4. 17:39
Rule > New > Probe based > Script(performance)
Object, Counter, Instance 적당한 값
Value: $Data/Property[@Name='Used Memory']$
-----------------------------------------------------------------------------------------------
UsedMemory.vbs
Dim oAPI, oBag
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set strFreeMemory = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
For Each Free In strFreeMemory
valFreeMemory = Free.FreePhysicalMemory / 1024
Next
Set strFreeMemory = Nothing
Set strTotalMemory = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
For Each Total In strTotalMemory
valTotalMemory = Total.TotalPhysicalMemory / 1048576
Next
Set strTotalMemory = Nothing
val = valTotalMemory - valFreeMemory
Call oBag.AddValue("Used Memory",val)
Call oAPI.Return(oBag)