Fixed got it workinghad forgot to restart the server
:P
Fixed got it workinghad forgot to restart the server
:P
How did you get the three columns to appear properly i have spent the last hour trying to do it and it just isnt liking it. I have punched the desk so many times my hand hurts
Is it possible for you to send me the full code for that page so i can just change the ip address'.
Thanks
Dan
Hmm i cam getting the following error:
"PHP Notice: Undefined index: debug in C:\Inetpub\wwwroot\ns\index.php on line 67"
which is:
if( $_GET["debug"] == "true" ) { $namesonly = false; }
Guys, can I just throw my 2 cents worth in here?
We have a system kind of like what you've all been doing at our school (written myself etc, like much of you!), however i found a problem... once some of the brighter kids figured out that it pinged and connected to several servers to see if they were up (wasnt that hard really... it's the most obvious way of doing it), they spammed it by refreshing a page.
Now one person doing this doesnt dent the intranet server... but multiply that by a class and boy does it go down quick.
We solved this by making a php script which did all the checks, then put the results into a DB. This script is run once a minute and can only be run by the server.
Then the public side of the system, simply iterates through the database and shows the systems and their status.
This might not be a problem for your schools... but it was for ours as soon as the cat got out the bag!
it's a debug notice... you dont have to listen to it. nothing is wrong that will stop it working. Simple solution is, disable debug notices in your php.ini.
E.g. mine is
This shows all errors except for notices and coding standards warnings.Code:error_reporting = E_ALL & ~E_NOTICE

I can now get it to display in 3 columns but they are 'under' each other (see image). How can i tell it to display these 'next' to each other.

I know the reason I was not getting reports of down servers was due to folk error (once I turned debug on the error msg came up)
As for undefined error think this will work at line 62:-
RussellCode:if (isset($_GET["debug"])) { if( $_GET["debug"] == "true" ) { $namesonly = false; } } else { }

Ok got bored
Started editing (or maybe hacking away with a big pick axe) the script so will put my version up.
All credit to above people who made this script etc.
Main difference are : -
- adding the above code to stop the debug error
- Adding a msg at the bottom of the screen that says how many and what servers are down (the as I call it the idiots msg as I can't be bothered to work the table out)
-If add ?portal=true to the end give you a cutdown view you can add to a portal
Code:<?php $hosts['10.56.156.16'] = 'LHS-SR-001'; $hosts['10.56.156.18'] = 'LHS-SR-002'; $hosts['10.56.157.16'] = 'LHS-SR-SIMS'; $hosts['10.56.156.15'] = 'Internal Support Server'; $ReportedErrors= ""; $portalview =""; if (isset($_GET["portal"])) { if( $_GET["portal"] == "true" ) { $portalview = true; } } else { } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <style type="text/css"> <!-- body{margin:0px;padding:0px;font-family: Tahoma, Verdana, Arial, sans-serif;} p{font-size:11px;margin:15px;line-height:150%;} td{font-size:10px;font-family:Verdana, Tahoma, Verdana, Arial;} input{font-size:11px;font-family:Tahoma;} img{border:0px;} --> </style> <title>Network Status</title> </head> <body> <p style="margin:1px;"> <table cellspacing="8" align="center"> <tr> <?PHP if ($portalview == False){ echo '<td colspan="3" align="center" style="border-bottom:4px solid gray;"> <span style="color:0080c0;font-size:18pt;font-weight:bold;font-family:tahoma;">Limehurst High School</span><br> <span style="color:gray;font-size:13pt;font-weight:normal;font-family:tahoma;"><b>Network</b> Status</span> <br> <!--<img src="printericon.jpg" width="147" height="143"> --> <br> <br> </td>'; } ?> </tr> <?php function ping($host){ $hostconnect = "Ping request could not find host ". $host . ". Please check the name and try again." ; $ipconnect = " Packets: Sent = 1, Received = 0, Lost = 1 (100% loss)," ; $rv = exec("ping $host -n 1 -w 1"); if( $ipconnect == $rv ) { return false; } else { if( $hostconnect == $rv ) { return false; } else { return true; } } } $namesonly = true; if (isset($_GET["debug"])) { if( $_GET["debug"] == "true" ) { $namesonly = false; } } else { } $faultcount = 0; foreach($hosts as $ip=>$name){ if( $namesonly == true ){ $txt = "$name"; } else { $txt = "$name <span style=\"font-weight: normal;\">($ip)</span>"; } if(ping($ip)){ echo '<tr><td style="font-size:11px;">'.$txt.'</td><td width="16"> </td><td align="center"><span style="color:#008000;"><strong>Up</strong></span></td></tr>'."\n"; } else { echo '<tr><td style="font-size:11px;">'.$txt.'</td><td width="16"> </td><td align="center"><span style="color:red;"><strong>Down</strong></span></td></tr>'."\n"; $ReportedErrors = $ReportedErrors . $name . ", "; $faultcount++; } } ?> </table> <?PHP if ($faultcount>0) { echo "<center> <SPAN style=\"font-size: 11pt\"><span style=\"color:red;\"><strong>There Are Currently $faultcount Connection Errors. <br> The Servers That Have Errors Are $ReportedErrors</strong></center></span></span>";} ?> </p> </body> </html>
Last edited by russdev; 2nd April 2008 at 03:26 PM.

I have asked fn to put this thread on the wiki...
Thought might be interested just got bored again and started hacking the script and now made it so that when added portal=true value to end of the url it either displays either
"All Servers Are Fine" or
"There Are Currently 1 Connection Errors. The Servers That Have Errors Are.."
Again all credit goes to above people I just hacked away the code.
RussCode:<?php $hosts['90.56.156.16'] = 'LHS-SR-001'; $hosts['10.56.156.18'] = 'LHS-SR-002'; $hosts['10.56.157.16'] = 'LHS-SR-SIMS'; $hosts['10.56.156.15'] = 'Internal Support Server'; $ReportedErrors= ""; $portalview =""; function ping($host){ $hostconnect = "Ping request could not find host ". $host . ". Please check the name and try again." ; $ipconnect = " Packets: Sent = 1, Received = 0, Lost = 1 (100% loss)," ; $rv = exec("ping $host -n 1 -w 1"); if( $ipconnect == $rv ) { return false; } else { if( $hostconnect == $rv ) { return false; } else { return true; } } } if (isset($_GET["portal"])) { if( $_GET["portal"] == "true" ) { $portalview = true; } } else { } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <style type="text/css"> <!-- body{margin:0px;padding:0px;font-family: Tahoma, Verdana, Arial, sans-serif;} p{font-size:11px;margin:15px;line-height:150%;} td{font-size:10px;font-family:Verdana, Tahoma, Verdana, Arial;} input{font-size:11px;font-family:Tahoma;} img{border:0px;} --> </style> <title>Network Status</title> </head> <body> <p style="margin:1px;"> <table cellspacing="8" align="center"> <tr> <?PHP if ($portalview == False){ echo '<td colspan="3" align="center" style="border-bottom:4px solid gray;"> <span style="color:0080c0;font-size:18pt;font-weight:bold;font-family:tahoma;">Limehurst High School</span><br> <span style="color:gray;font-size:13pt;font-weight:normal;font-family:tahoma;"><b>Network</b> Status</span> <br> <!--<img src="printericon.jpg" width="147" height="143"> --> <br> <br> </td>'; } ?> </tr> <?php $namesonly = true; if (isset($_GET["debug"])) { if( $_GET["debug"] == "true" ) { $namesonly = false; } } else { } $txt = ""; $faultcount = 0; foreach($hosts as $ip=>$name){ if( $namesonly == true ){ if ($portalview == False){ $txt = "$name"; } } else { if ($portalview == False){ $txt = "$name <span style=\"font-weight: normal;\">($ip)</span>"; } } if(ping($ip)){ if ($portalview == False){ echo '<tr><td style="font-size:11px;">'.$txt.'</td><td width="16"> </td><td align="center"><span style="color:#008000;"><strong>Up</strong></span></td></tr>'."\n"; } } else { if ($portalview == False){ echo '<tr><td style="font-size:11px;">'.$txt.'</td><td width="16"> </td><td align="center"><span style="color:red;"><strong>Down</strong></span></td></tr>'."\n"; } $ReportedErrors = $ReportedErrors . $name . ", "; $faultcount++; } } ?> </table> <?PHP if ($faultcount>0) { echo "<center> <SPAN style=\"font-size: 11pt\"><span style=\"color:red;\"><strong>There Are Currently $faultcount Connection Errors. <br> The Servers That Have Errors Are $ReportedErrors</strong></center></span></span>"; }else { echo "<center> <SPAN style=\"font-size: 11pt\"><span style=\"color:#008000;\"><strong>All Servers Are Fine</strong></span></span>";} ?> </p> </body> </html>

Its been on the wiki for a while, but not the new code. You can find it here: Helpdesk network status - EduGeek.net Wiki
I did announce it in this post: New & Updated Wiki Pages

Sorry missed that one.

no worries![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)