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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server Ping

Status
Not open for further replies.

varnix

Programmer
Joined
Jan 7, 2002
Messages
94
Location
US
I am attempting to ping one of my servers from my CF script. I am using the CFExecute command as follows:


cfexecute
name="ping.exe"
arguments="ipaddress"


The output comes on the screen - but it is all jumbled. Is there any way to either format the output (I've tried using outputfile option but I haven't been able to include the data file) - or is there a way to obtain some sort of result in a different manner.

We're trying to build an online system that our operations staff can monitor the servers from.

Thanks!
 
Hey Varnix,

I suspect you just need to change the DOS based line breaks to HTML <br> tags. You can either put <pre></pre> tags around the output to make it display correctly or just do a #replace(myOutput,#chr(10)#,&quot;<br>&quot;,&quot;all&quot;)# to convert to html.

Hope this helps,
GJ
 
When setting up a monitoring system, I'd recommend going further than just ping. Often times when a webserver goes down, you can still ping it, but it doesn't serve up any pages. Ping can be a way to check to see if the server is up or not, but it often doesn't tell.

I'd recommend using something like:

=== START CODE EXAMPLE ===
<cftry>
<cfhttp url=&quot;ipaddress&quot;
timeout=&quot;10&quot;
throwonerror=&quot;Yes&quot;/>


<cfset vStatusCode = cfhttp.statuscode>

<cfcatch type=&quot;COM.Allaire.ColdFusion.HTTPFailure&quot;>
<cfset vStatusCode = &quot;Can't Connect&quot;>
</cfcatch>
</cftry>

<cfoutput>
#variables.vStatusCode#
</cfoutput>
=== END CODE EXAMPLE === - tleish
 
I'm batting about .10 with this one, I think its something with the configuration of some of our servers though.

It worked great on my Linux web server, but my Coldfusion box I received a 401 error message, in another box I get a 403 forbidden error.

But, all of that aside - I'd also like to use this for monitoring other servers that are not web servers. Such as a few AIX services PC's and a couple of Compaq Alphas.

Any suggestion?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top