coolglay 发表于 2007-7-12 11:31:36

有没有25端口监控软件,就是一直监控25端口

有没有端口监控软件,就是一直监控25端口,如果发现死了,或连接不上25(telnet),就直接重启邮局服务端进程。在服务器上运行的


可以写一段BAT代码吗?就是隔2分钟自动TELNET一下25端口(telnet 结果如是220就是正常),如发现不通(连接不上25端口),就自动重启邮局进程(直接写上进程的路径即可)。

55aa 发表于 2007-7-12 11:35:47

呵呵,不错的想法,帮顶!~:lol

coolglay 发表于 2007-7-13 12:02:10

高手呢?会程序的老大们啊,你们写一个小程序吧,谢谢了啊!!!!!!!!!!!!!!!

flymeteor 发表于 2007-7-13 13:31:22

在25端口长被占用的话,我建议你检查你的服务器是否中了病毒~!·

正常情况下是不会出现这样的问题的~!·

要不然我们还得些个重起80    21   110   3389端口的程序

coolglay 发表于 2007-7-13 13:36:52

没病毒,是邮件量大造成的,还是MF杀软也有影响。不是经常,但2-3天就有这么一次,主要是麻烦,客户老反应同一个问题,是很郁闷的,所以想搞一个这样的程序来监控25端口,否则每次还要上服务器重启邮局服务。

flymeteor 发表于 2007-7-13 15:09:21

你有多少用户在使用??

我的服务器是hp的    至强2.8    256内存   跑winwebmail没有任何问题

出了几次病毒干扰,没有任何的问题!·

我建议你还是查查病毒吧~·!

coolglay 发表于 2007-7-13 16:59:37

病毒肯定是查过的啦,我首先是排除掉病毒这个问题啦~进程监控我也查过了,没木马,没病毒。

我俩相爱 发表于 2007-7-13 17:00:06

我帮顶,我以前也有这样的情况出现,跟邮件量大有点关系。有个软件可以监测25,110,80等端口的,至于是什么软件忘记了。你不防可以搜索下这方面的软件。但达不到重启服务(你写的是进程)的要求啊。

yiwang_xiaojia 发表于 2007-7-23 15:26:45

我写了个脚本 可以监控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 = "<td>25 端口 CLOSE_WAIT</td>"
              Case "POP3"
          strText = "<td>110端口 CLOSE_WAIT</td></tr>"
   End Select
Else
   Select Case style
               Case "SMTP"
                strText = "<td>25 端口正常</td>"
              Case "POP3"
                strText = "<td>110端口正常</td></tr>"
   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) AndNot 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 = "<tr><td>" & Time & "</td>"
objProc.Create "cmd /cNetstat -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)
DoUntil tf1.AtEndOfStream
    strNextLine1 = tf1.ReadLine
    If Len(strNextLine1) > 0 Then
      strLine1 = strNextLine1
    End If
Loop
tf1.Close
SMTP = strText(strLine1, "SMTP")
objProc.Create "cmd /cNetstat -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)
DoUntil 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 "<html><head><style><!--body,td{ font-family: 宋体; font-size: 9pt }--></style></head><body topmargin=0 leftmargin=0></b><table border cellspacing=0.1><tr><td>时间</td><td>端口25状态</td><td>端口110状态</td></tr>"
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

coolglay 发表于 2007-7-24 09:39:13

谢谢楼上的老大写代码,可是啥用?好像不是ASP的吧,你是用VB写的?好像没看到代码中有重启WWM服务的代码噢,小弟不才,等你写好发布。
页: [1] 2
查看完整版本: 有没有25端口监控软件,就是一直监控25端口