SCOM 2007 - 사용자 정의 성능 수집 VBS (VB Script) SystemCenter2009. 1. 9. 22:59
Netstat -an | findstr "ESTABLISHED"해서 ESTABLISHED 세션 수 성능 수집
Rule > New > Probe based > Script(performance)
Object, Counter, Instance 적당한 값
Value: $Data/Property[@Name='ESTABLISHED Count']$
---------------------------------------------------------------------------------------------------------------
ESTABLISHED.vbs
Dim oAPI, oBag
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile (".\ESTABLISHED.BAT", 8, True)
objTextFile.WriteLine("netstat -an -p tcp | findstr ESTABLISHED")
objTextFile.Close
Set objTextFile = nothing
Set shellobj=WScript.CreateObject("WScript.Shell")
Set execObj=shellobj.Exec(".\ESTABLISHED.BAT")
OutData=execObj.StdOut.ReadAll()
val=execObj.StdOut.Line - 3
Set aFile = objFSO.GetFile(".\ESTABLISHED.BAT")
aFile.Delete
Set aFile = nothing
Set execObj = nothing
Call oBag.AddValue("ESTABLISHED Count",val)
Call oAPI.Return(oBag)