does anyone have a simple baseline script / function I could review.

I am wanting to design a simple monitor for my intranet that monitors status of about 5 servers and about 12 ports to ensure services are running.

here's what I am wanting to monitor,
1 mail server (SMTP, POP, and Exchange)
1 web server (port 80, 8080)
1 ftp server
1 ssh connection
1 terminal services connection (win2003).

I am wanting to run this on a linux server.

all I am currently looking for is a push in the right direction (or if someone has a script that could be a good start).

thanks

    Hi Dugindog

    Are you sure you want PHP to do this? I assume you want to set up an HTML page which utilizes PHP to check the status of your servers every time you call up the page? (i.e. you have to call up the page manually and check it).

    Don't ask me any questions about this, because I don't know the answers, but I suspect that some sort of combination of Perl and cron-jobs is actually what you're looking for. What you need is a script which emanates from the server and notifies you either on-screen or per e-mail / text message that something is wrong, based on the premise that no news is good news.

    I don't believe PHP is the answer to that, although a combination of PHP and a more OS-localized script (VB for Win or Perl for Linux) might do the trick.

    Sorry not to be more helpful - I'm out of my depth on this one.

    Norm

      Here's an option.

      Set up all of your IP's and ports in an array. Then loop through the array, and use fsockopen() to see if you can connect to the port and get an appropriate response.

      You can then decide on what to do with the information. You could log to a textfile everytime the script is run, and note the results for each service. You might also decide to send an email or an sms if any of the services fails to respond.

      Once you have the script running from the command line (ie not through a browser), you can then cron it to run every 15 minutes, or every hour or whatever you need.

        Not sure if you already know, but theres something that handles services monitoring for you already (google for Nagios).

          Write a Reply...