Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: php server status page?

  1. #1
    Join Date
    Sep 2006
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default php server status page?

    Hey,

    I have three different servers, and I want to have a status page to show that services such as POP3, SMTP, HTTP, etc etc would be shown as active or failed...

    could anyone point me in the correct direction please?

  2. #2
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    well, basically it's a better job for a perl script. Either way, you didn't specify platform you'll be running the script on. That has to be said, because Windoze handles that different than UNIX/Linux

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    well, basically it's a better job for a perl script.
    Why? PHP is quite capable of doing it.
    Either way, you didn't specify platform you'll be running the script on. That has to be said, because Windoze handles that different than UNIX/Linux
    No, PHP glosses over the differences quite nicely.
    Code:
    <?php
      $servers = array(
        'Server One' => 'server1.com',
        'Server Two' => 'server2.com',
        'Server Three' => 'server3.com'
      );
    
      $services = array(
        'SMTP' => 25,
        'HTTP' => 80,
        'POP' => 110
      );
    
      foreach($servers as $svrName => $host) {
    ?>
    <table class="serviceTable">
      <tr>
        <th colspan="2" class="serverName">
          <?php echo($svrName); ?>
        </th>
      </tr>
    <?php
        foreach($services as $svcName => $port) {
          $status = 'Available';
          $f;
          if(!($f = fsockopen($host, $port, $errno, $errstr, 3)))
          // The number above is a timeout.  A bigger
          // number will result in better accuracy but
          // longer page loading time.
            $status = 'Unavailable';
          else fclose($f);
          // The connection worked; we don't need to
          // do anything else with the socket, so we
          // close it.
    ?>
      <tr>
        <td class="serviceName">
          <?php echo($svcName); ?>
        </td>
        <td class="serviceStatus">
          <?php echo($status); ?>
        </td>
      </tr>
    <?php
        }
    ?>
    </table>
    <?php
      }
    ?>
    Untested.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Sep 2006
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    oh sorry, its a linux Fedora Core VPS with webfusion..

  5. #5
    Join Date
    Sep 2006
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    excellent thank you, What other port numbers would be useful?

  6. #6
    Join Date
    Sep 2006
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    scrub that, found this

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Ouch. If you're going to check all those, it might be wise to just display/parse the output of nmap.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    Sep 2006
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hmm, i'm trying to check mysql, but 118 158 and 3006 dont work.. any ideas?

  9. #9
    Join Date
    Sep 2006
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    no i dont want them all lol... just FTP, HTTP, SMTP, POP3, Mysql and shoutcast

  10. #10
    Join Date
    Sep 2006
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by munkynpunky
    hmm, i'm trying to check mysql, but 118 158 and 3006 dont work.. any ideas?
    done lol

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •