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?
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?
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
Why? PHP is quite capable of doing it.well, basically it's a better job for a perl script.No, PHP glosses over the differences quite nicely.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/LinuxUntested.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 } ?>
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!
oh sorry, its a linux Fedora Core VPS with webfusion..
excellent thank you, What other port numbers would be useful?
scrub that, found this
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!
hmm, i'm trying to check mysql, but 118 158 and 3006 dont work.. any ideas?
no i dont want them all lol... just FTP, HTTP, SMTP, POP3, Mysql and shoutcast
done lolOriginally Posted by munkynpunky
Bookmarks