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!

ASP Coding Help please..

Status
Not open for further replies.

PaulSc

MIS
Aug 21, 2000
148
GB
I have been tasked with writing a "traffic light" system using asp to display the status of a server(s)/host(s) based on the results of a "PING"

Essentially if the ping returns Ok <10ms its a green,
ok >10ms Orange and no result Red..

this is to be displayed in an auto refreshing for with alerts etc when red is activated...

Have to admit I have not really got a clue where to start so any pointers from anybody out there please?? Or can anybody recommend an example to look for??

TIA
PaulSc
 
I'd probably put the ASP page that does the ping in an iframe in a regular HTML page. That way the whole page won't refresh, but you'll get the functionality you want. You could even make the background of the iframe green, yellow, or red depending on the results returned from the ping.

Lee
 
PaulSc
You can use something like this:
<%
sExecStr = "ping
Set oShell = Server.CreateObject("WScript.Shell")
Set oExec = oShell.Exec(sExecStr)
Do
tmpStr = oExec.StdOut.ReadAll()
Loop While Not oExec.Stdout.atEndOfStream
RetCode = oExec.stderr.readall

%>

This executes a server side shell command to do the ping and read the results back from the screen into tmpStr.
You would then have to parse through tmpStr to look for errors or the response time values so that you know how to react.
You could easily turn this into a function in which you pass the IP number to ping and return a value appropriate to your need.

As another example, this link shows how to use ASP and a SQL database to do the same thing. They have taken it further in parsing out the text response. You could use this method or you could adapt the method for parsing the info to the above.


Paranoid? ME?? WHO WANTS TO KNOW????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top