服务器系统端口监控,有没有25端口监控软件,就是一直监控25端口

我写了个脚本 可以监控25 110 的状况,但是就不知道怎样获取“待发邮件数”,

有谁知道WinWebMail 的 adminmsg 目录下的statistics.txt文件中的各个数值的意思?

'Dim Path, LogFile

Path    = "D:\test\"

LogFile = Date & "_Port.htm"

Function strText(Text, style)

Set regEx       = New RegExp

regEx.Global    = True

regEx.IgnoreCase= True

regEx.Pattern   = "CLOSE_WAIT"

If regEx.Test(text) Then

Select Case style

Case "SMTP"

strText = "

25 端口 CLOSE_WAIT"

Case "POP3"

strText = "

110端口 CLOSE_WAIT"

End Select

Else

Select Case style

Case "SMTP"

strText = "

25 端口正常"

Case "POP3"

strText = "

110端口正常"

End Select

End If

End Function

strComputer= "."

Set objSWbemServices = GetObject("Winmgmts:\\" & strComputer & "\root\cimv2")

Set colNetwork  = objSWbemServices.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")

For Each objNetworkConf in colNetwork

If Not IsNull(objNetworkConf.IPAddress) And Not IsNull(objNetworkConf.DefaultIPGateway) And  Not IsNull(objNetworkConf.DNSServerSearchOrder) Then

IPPortSMTP = objNetworkConf.IPAddress(0) & ":25 "

IPPortPOP3 = objNetworkConf.IPAddress(0) & ":110 "

End If

Next

Set FSO         = CreateObject("Scripting.FileSystemObject")

Set objStartup  = objSWbemServices.Get("Win32_ProcessStartup")

Set objConfig   = objStartup.SpawnInstance_

objConfig.ShowWindow = 12

Set objProc     = objSWbemServices.Get("Win32_Process")

dtmTime = "

" & Time & ""

objProc.Create "cmd /c  Netstat -n |Find """ & IPPortSMTP & """ > " & Path & "PortTemp.txt", Null, objConfig, pingPID

Set colProcess = objSWbemServices.ExecNotificationQuery("Select * From __InstanceDeletionEvent WithIn 1 Where TargetInstance ISA 'Win32_Process'")

Do Until c = 999

Set objProErr = colProcess.NextEvent

If objProErr.TargetInstance.ProcessID = pingPID Then

Exit Do

End If

Loop

Set tf1 = FSO.OpenTextFile(Path & "PortTemp.txt", 1)

Do  Until tf1.AtEndOfStream

strNextLine1 = tf1.ReadLine

If Len(strNextLine1) > 0 Then

strLine1 = strNextLine1

End If

Loop

tf1.Close

SMTP = strText(strLine1, "SMTP")

objProc.Create "cmd /c  Netstat -n |Find """ & IPPortPOP3 & """ > " & Path & "PortTemp.txt", Null, objConfig, pingPID

Set colProcess = objSWbemServices.ExecNotificationQuery("Select * From __InstanceDeletionEvent Within 1 Where TargetInstance ISA 'Win32_Process'")

Do Until c = 999

Set objProErr = colProcess.NextEvent

If objProErr.TargetInstance.ProcessID = pingPID Then

Exit Do

End If

Loop

Set tf2 = FSO.OpenTextFile(Path & "PortTemp.txt", 1)

Do  Until tf2.AtEndOfStream

strNextLine2 = tf2.ReadLine

If Len(strNextLine2) > 0 Then

strLine2 = strNextLine2

End If

Loop

tf2.Close

POP3 = strText(strLine2, "POP3")

On Error Resume Next

Set tf3      = fso.CreateTextFile(Path & LogFile, False)

ErrNumber    = Err.Number

tf3.WriteLine "

时间端口25状态端口110状态

tf3.WriteLine dtmTime & SMTP & POP3

tf3.Close

On Error GoTo 0

If ErrNumber = 58 Then

Set tf4 = fso.OpenTextFile(Path & LogFile, 8)

tf4.WriteLine dtmTime & SMTP & POP3

tf4.Close

End If

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值