2012. 8. 27. 14:51
SCOM 스크립트 - 가용 메모리 비율 모니터링 Etc.2012. 8. 27. 14:51
SCOM 2012 System Center Operations Manager
스크립트 기반 vbs 사용 가능한 메모리 비율 모니터링
' Property[@Name='Status'] GOOD or BAD
스크립트 기반 vbs 사용 가능한 메모리 비율 모니터링
' Property[@Name='Status'] GOOD or BAD
' Property[@Name='
Percentage of free memory']
Dim oAPI, oBag
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
Set oArgs = WScript.Arguments
If oArgs.Count = 0 Then
THRESHOLD = 2
Else THRESHOLD = oArgs(0)
End If
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colOS = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
For Each objOS in colOS
TotalMemoryKB = objOS.TotalVisibleMemorySize
Next
Set colOS = NOTHING
Set colPerf = objWMIService.ExecQuery ("Select * from Win32_PerfFormattedData_PerfOS_Memory")
For Each objPerf in colPerf
FreeMEMPercent = Round((objPerf.AvailableKBytes / TotalMemoryKB)*100,2)
Next
Set colPerf = NOTHING
Set objWMIService = NOTHING
Call oBag.AddValue("Percentage of free memory",FreeMEMPercent)
If FreeMEMPercent < cInt(THRESHOLD) Then
Status = "BAD"
Else Status = "GOOD"
End If
Call oBag.AddValue("Status",Status)
Call oAPI.Return(oBag)