1. Home
  2. Computing & Technology
  3. Perl

Creating a simple service monitoring CGI script

From About.com

3 of 5

Checking the services

This for loop is the heart of our script. It's in this loop that we go through the list of servers and attempt a plain TCP socket connection to the specified port and IP address. If the socket connection succeeds, we know that the service is up and at least accepting incoming connections. If the socket connection fails, we know that the service is not running correctly on the specified port and is down.

It's here that we use the IO::Socket Perl module to attempt the connection with the simple IO::Socket::INET->new. function that created a new socket object and attempts the connection.

Explore Perl
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Perl
  4. Applied Programming
  5. Creating a simple server monitor in Perl to check the status of your internet services.

©2009 About.com, a part of The New York Times Company.

All rights reserved.