winmastergames Posted December 28, 2007 Share Posted December 28, 2007 Hi Im trying to make a script that monitors servers if they are online or not how will i start off doing this. I thought you could have a form that asks the user for the Server Port and Name it then adds it to a MYSQL database then on the server status page it just checks the database for servers then checks they are online or not then displays them into a table How will i do this or is there an easier way to do this I have found this script on the internet how will i be able to edit it to suit my needs status.html <html> <head> <title>Web Server Status</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF"> <table border="0" cellspacing="0" cellpadding="3"> <tr> <td width="77%"><font face="Arial, Helvetica, sans-serif" size="2">Microsoft.com</font></td> <td width="23%"><img src="status.php?link=www.microsoft.com" width="37" height="20"></td> </tr> <tr> <td width="77%"><font face="Arial, Helvetica, sans-serif" size="2">Apple.com</font></td> <td width="23%"><img src="status.php?link=www.apple.com" width="37" height="20"></td> </tr> <tr> <td width="77%"><font face="Arial, Helvetica, sans-serif" size="2">RedHat.com</font></td> <td width="23%"><img src="status.php?link=www.redhat.com" width="37" height="20"></td> </tr> <tr> <td width="77%"><font face="Arial, Helvetica, sans-serif" size="2">Google.com</font></td> <td width="23%"><img src="status.php?link=www.google.com" width="37" height="20"></td> </tr> </table> </body> </html> And Status.php <?php //Web Server Status v 1.4, Copyright 2002 By Ryan Schwiebert, visit http://www.schwebdesigns.com/ //This script may be freely distributed providing all copyright headers are kept intact. //Concept from: //Abax Server Status v1.04, Copyright 2002 By Nathan Dickman, visit http://www.NathanDickman.com/ //Location of the live or dead server images //Please change to your server specifications $live = "live2.gif"; $dead = "dead2.gif"; //The status checking script //meddle at your own risk! //check for port number, default is 80 $link = $_GET['link'].":"; $s_link = str_replace("::", ":", $link); list($addr,$port)= explode (':',"$s_link"); if (empty($port)){ $port = 80; } //Test the server connection $churl = @fsockopen(server($addr), $port, $errno, $errstr, 20); if (!$churl){ //echo $errstr; header("Location: $dead"); } else { header("Location: $live"); } function server($addr){ if(strstr($addr,"/")){$addr = substr($addr, 0, strpos($addr, "/"));} return $addr; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/83510-solved-server-status-page-allow-users-to-add-servers-to-the-list/ Share on other sites More sharing options...
monkeytooth Posted December 28, 2007 Share Posted December 28, 2007 If you want an automated process so you can get notifications or anyone could get notifications of it being down or up I would say most likely do a cron, otherwise if you just want it to be called when a user acesses part of your site just include the file as part of the page your user is acessing, may need to edit it a bit though. Quote Link to comment https://forums.phpfreaks.com/topic/83510-solved-server-status-page-allow-users-to-add-servers-to-the-list/#findComment-424942 Share on other sites More sharing options...
winmastergames Posted December 28, 2007 Author Share Posted December 28, 2007 Umm well have a look at the script i supilled I just want that But have another page that allows the user to add a server to be checked Quote Link to comment https://forums.phpfreaks.com/topic/83510-solved-server-status-page-allow-users-to-add-servers-to-the-list/#findComment-424946 Share on other sites More sharing options...
winmastergames Posted December 29, 2007 Author Share Posted December 29, 2007 Does anyone know? Quote Link to comment https://forums.phpfreaks.com/topic/83510-solved-server-status-page-allow-users-to-add-servers-to-the-list/#findComment-425118 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.