SCOM 2007에서 특정 IP에 대한 Ping 응답 시간(ms) 성능 로그 규칙 SystemCenter2008. 12. 19. 14:45
Rule -> New -> Collection Rules -> Probe Base -> Script(Perfomance)
Parameters
1: IP-adress to ping - 192.168.0.10
2: Timeout (ms) - 1000
3: Buffertsize - 4096
ex) 127.0.0.1 1000 4096
Performance mapper
Object = PingRoundtrip
Counter = $Data/Property[@Name='serverToPingFrom']$
Instance = $Data/Property[@Name='serverToPingIP']$
Value = $Data/Property[@Name='Roundtrip']$
--------------------------------------------------------------------------------------------
Option Explicit
Dim serverToPingIP, serverToPingFrom, pingTimeout, pingBufferSize, perfData
Dim oArgs, oPing, oStatus, oAPI, oBag
'- Get parameters
Set oArgs = WScript.Arguments
serverToPingIP = oArgs.Item(0)
pingTimeout = oArgs.Item(1)
pingBufferSize = oArgs.Item(2)
Set oArgs = Nothing
'- Get computername
Set oArgs = WScript.CreateObject("WScript.Network")
serverToPingFrom = oArgs.ComputerName
Set oArgs = Nothing
'- Ping the host
Set oPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
ExecQuery("select * from Win32_PingStatus where address = '" & serverToPingIP & "' and BufferSize=" & pingBufferSize & " And Timeout=" & pingTimeout)
For Each oStatus in oPing
If IsNull(oStatus.StatusCode) Or oStatus.StatusCode<>0 Then
perfData = pingTimeout 'Got no answer. logging maxTime
Else
perfData = oStatus.ResponseTime 'Got answer, logging responsetime
End If
Next
Set oPing = Nothing
Set oStatus = Nothing
'- Create properies in SCOM
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
oBag.AddValue "serverToPingIP", serverToPingIP
oBag.AddValue "serverToPingFrom", serverToPingFrom
oBag.AddValue "pingTimeout", pingTimeout
oBag.AddValue "pingBufferSize", pingBufferSize
oBag.AddValue "Roundtrip", perfData
oAPI.AddItem(oBag)
oAPI.ReturnItems
Set oAPI = Nothing
Set oBag = Nothing