달력

1

« 2025/1 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

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)

:
Posted by 커널64