SCOM: Locally Monitoring a Listening TCP Port
August 13, 2009 3 Comments
The core logic can be seen in this excerpt:
sCmd = “netstat -an -proto TCP”
set objShell = createobject(“wscript.shell”)
set objExec = objShell.exec(sCmd)
set oStdOut = objExec.stdoutbl_Healthy = false
Do until oStdOut.AtEndofStream
sLine = “”
sLine = oStdOut.ReadLine
if instr(sLine, “LISTENING”) > 0 and instr(sLine,”:” & nPortToCheck) then
bl_healthy = true
end if
loop
The full script can be downloaded here (this is provided as-is, with no guarantee of function or support, test before deploying, etc).
Walkthrough on creating a corresponding Unit Monitor behind the cut
