Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking server status 1

Status
Not open for further replies.

gbaughma

IS-IT--Management
Staff member
Nov 21, 2003
4,772
US
I'd like to take credit for writing this, but I didn't... I just modified it to work on our web system.

Since we have several servers and remote sites, I incorporated this into our main web page for a simple "is the server up?" script.

Code:
<% Response Buffer=True %>
<%
url = "1.2.3.4" ' IP Address of server.. .use the IP 'cause it's faster

Set objWShell = CreateObject("WScript.Shell")
Set objCmd = objWShell.Exec("ping -n 1 " & url)
strPResult = objCmd.StdOut.Readall()
set objCmd = nothing : Set objWShell = nothing

strStatus = "<font color=red>Offline!</font>"
if InStr(strPResult,"TTL=")>0 Then strStatus = "<font color=green>Online</font>"

response.Write "ServerName is " & strStatus
%>



Just my 2¢

"In order to start solving a problem, one must first identify its owner." --Me
--Greg
 
Interesting idea, Greg. I know that we occasionally have similar issues and this might find some use in our environment. I'll try it and see what happens. Thanks!

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top