Monitoring WebSite State
Const EVENT_SUCCESS=0
Const EVENT_ERROR=1
Const EVENT_WARNING=2
Const EVENT_INFORMATION=4
Const EVENT_AUDIT_SUCCESS=8
Const EVENT_AUDIT_FAILURE=16
Const ForReading = 1
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("web.txt", ForReading)
i = 0
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
objDictionary.Add i, strNextLine
i = i + 1
loop
For Each objItem in objDictionary
strLine = objDictionary.Item(objItem)
send_request(strLine)
Next
function send_request(url)
set http_request = CreateObject( "Msxml2.XMLHTTP")
'http_request.setRequestHeader "Content-Type","text/html;charset=gb2312"
http_request.open "GET ", url, false
sub_echo=""
code="0"
fname=Replace(Replace(Replace(Replace(url,"/","_"),"","_"),":","_"),".","_")
On Error Resume Next
http_request.send(null)
If Err.Number <> 0 Then
sub_echo="Unavailable"
If Not objFSO.Fileexists(fName) Then
Call EventLogingError(url,sub_echo,code)
Set f1= objFSO.Createtextfile(fName, true)
End If
Err.Clear
Else
If http_request.statusText="OK" Then
If objFSO.Fileexists(fName) Then
sub_echo="OK"
code=http_request.Status
Call EventLogingSuccess(url,sub_echo,code)
set f2 = objFSO.getfile(fName)
f2.delete
End If
Else
sub_echo="BAD"
code=http_request.Status
If Not objFSO.Fileexists(fName) Then
Call EventLogingError(url,sub_echo,code)
Set f1= objFSO.Createtextfile(fName, true)
End If
End If
End If
set http_request=nothing
end function
Function EventLogingError(url,textstate,code)
Set objShell = CreateObject("Wscript.Shell")
objShell.LogEvent EVENT_ERROR, _
"Error: There URL OF "&url&" Current State is "&textstate&" With Return Code "&code&" !"
End Function
Function EventLogingSuccess(url,textstate,code)
Set objShell = CreateObject("Wscript.Shell")
objShell.LogEvent EVENT_SUCCESS, _
"Success: There URL OF "&url&" Current State is "&textstate&" With Return Code "&code&" !"
End Function
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12262773/viewspace-1048922/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- godaddy 的 Monitoring performance to make your website fasterGoORMWebAST
- Website-Monitoring:Google+事實和資料–資料資訊檢視WebGo
- Website-Monitoring:Google+男性使用者比例超60% Facebook僅為45%WebGo
- Website Monitoring:有超過150萬家企業在Facebook網站設主頁Web網站
- useful websiteWeb
- Website Performance OptimizationWebORM
- website architectureWeb
- SAP useful websiteWeb
- my flash websiteWeb
- torrent cache websiteWeb
- STREAMS MONITORING
- Column Monitoring
- how to build a website like apkmirrorUIWebAPK
- 儲存知識websiteWeb
- Oracle:TABLE MONITORINGOracle
- oracle index monitoringOracleIndex
- learn english, a good website to learn englishGoWeb
- cpp website資源彙總Web
- Oracle EBS Monitoring ScriptsOracle
- Monitoring an SAP instance
- sql monitoring實驗SQL
- Monitoring Core Process...
- Monitoring Open and Cached Cursors
- Monitoring RMAN Backups
- how bootstrap fit into our website design?bootWeb
- online website Performance testingWebORM
- Go: sysmon, Runtime MonitoringGo
- Oracle Real Time SQL MonitoringOracleSQL
- Monitoring Open and Cached Cursors(zt)
- build a large e-commerce websiteUIWeb
- Vuex之stateVue
- Working with State
- Oracle9i Table monitoring 及10g table預設monitoring屬性Oracle
- PostgreSQL DBA(77) - Locks(Lock Monitoring)SQL
- 對索引開啟monitoring方法索引
- Top DBA Shell Scripts for Monitoring the DatabaseDatabase
- Monitoring Open and Cached Cursors(轉載)
- Java Monitoring, Management and Troubleshooting ToolsJava