[Tutor] Pinging a service

Tim Golden mail at timgolden.me.uk
Fri Jun 13 10:18:52 CEST 2008


Greg Lindstrom wrote:
> Hello,
> 
> I would like to write a routine to monitor services running on a
> remote box. My initial thought is to "ping" the remote box to monitor
> latency and then execute a query on the remote machine to monitor the
> database. What I would like is to gather data points and graph the
> delay to see if there are any patterns;
> 
> A) Is this a sound strategy?
> 
> B) Are there libraries for the "ping"ing aspect?  If not, I can
> execute the ping using "command"...how can I capture the screen output
> to get the times?

Pinging is actually a more complex beast than you might imagine.
If you know what ports the services are running on, or at least if
you know one service a box *should* be running, you could do
worse than to attempt a socket connection to that port number. For
example, seeing if a (not desperately secured) Windows box is
up is a question of attempting a connection on port 445. Likewise,
seeing if a web server (box) is running, you can try port 80. etc.

TJG


More information about the Tutor mailing list