Valentine Posted March 28, 2008 Posted March 28, 2008 I see, then in that case i am just having the same problem as John D. Must be something to do with checking the result of the ping command. Have got the code to display ok (IIS) but it says everything is up even when I point it to names/ip address that do not exist? Am I missing something here?
webman Posted March 28, 2008 Posted March 28, 2008 We now use Monit running on a linux box and checks essential ports on our other servers. Our monitrc file is here.
tomscaper Posted March 30, 2008 Posted March 30, 2008 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! I can see this being a problem in our school too, some of the more clever kids have found out differnt commands and are messing around, not long before they figure out the ping command. Any chance of seeing your php script.
DSapseid Posted March 31, 2008 Posted March 31, 2008 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.
russdev Posted April 2, 2008 Posted April 2, 2008 I see, then in that case i am just having the same problem as John D. Must be something to do with checking the result of the ping command. 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:- if (isset($_GET["debug"])) { if( $_GET["debug"] == "true" ) { $namesonly = false; } } else { } Russell
russdev Posted April 2, 2008 Posted April 2, 2008 (edited) 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 $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 { } ?> <br /> <!--<br /> <br /> body{margin:0px;padding:0px;font-family: Tahoma, Verdana, Arial, sans-serif;}<br /> p{font-size:11px;margin:15px;line-height:150%;}<br /> td{font-size:10px;font-family:Verdana, Tahoma, Verdana, Arial;}<br /> input{font-size:11px;font-family:Tahoma;}<br /> img{border:0px;}<br /> --><br /> Network Status </pre><table cellspacing="8" align="center"> if ($portalview == False){ echo ' Limehurst High School Network Status '; } ?> 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 ($ip)"; } if(ping($ip)){ echo ''.$txt.' Up'."\n"; } else { echo ''.$txt.' Down'."\n"; $ReportedErrors = $ReportedErrors . $name . ", "; $faultcount++; } } ?> </table><br><br>if ($faultcount>0) {<br>echo "<center> There Are Currently $faultcount Connection Errors. The Servers That Have Errors Are $ReportedErrors</center>";}<br><br>?><br><br><br><br><br><b Edited April 2, 2008 by russdev
russdev Posted April 3, 2008 Posted April 3, 2008 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. $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 { } ?> <br /> <!--<br /> <br /> body{margin:0px;padding:0px;font-family: Tahoma, Verdana, Arial, sans-serif;}<br /> p{font-size:11px;margin:15px;line-height:150%;}<br /> td{font-size:10px;font-family:Verdana, Tahoma, Verdana, Arial;}<br /> input{font-size:11px;font-family:Tahoma;}<br /> img{border:0px;}<br /> --><br /> Network Status </pre><table cellspacing="8" align="center"> if ($portalview == False){ echo ' Limehurst High School Network Status '; } ?> $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 ($ip)"; } } if(ping($ip)){ if ($portalview == False){ echo ''.$txt.' Up'."\n"; } } else { if ($portalview == False){ echo ''.$txt.' Down'."\n"; } $ReportedErrors = $ReportedErrors . $name . ", "; $faultcount++; } } ?> </table><br><br>if ($faultcount>0) {<br>echo "<center> There Are Currently $faultcount Connection Errors. The Servers That Have Errors Are $ReportedErrors</center>";<br>}else {<br>echo "<center> All Servers Are Fine";} ?> </c Russ
FN-GM Posted April 3, 2008 Posted April 3, 2008 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: http://www.edugeek.net/forums/wiki-announcements/17365-new-updated-wiki-pages.html
russdev Posted April 4, 2008 Posted April 4, 2008 @Fn Can we stick ittechs and nickparsk version of the script up asw ell please. Russ
ICTNUT Posted April 4, 2008 Posted April 4, 2008 (edited) Just as an update to this thread I am about to finish a windows version of the network status page which is backed on to a database and will query any windows server (Service). You can add any number of services per server and currently the script uses an msAccess database for holding server / service information. It will run on native IIS as it is written in ASP. As sson as I have done that last bit I need to do I will post up a zip file so you can all play. Edited April 4, 2008 by ICTNUT 3
mullet_man Posted April 4, 2008 Posted April 4, 2008 Just as an update to this thread I am about to finish a windows version of the network status page which is backed on to a database and will query any windows server (Service). You can add any number of services per server and currently the script uses an msAccess database for holding server / service information. It will run on native IIS as it is written in ASP. As sson as I have done that last bit I need to do I will post up a zip file so you can all play. That sounds great cheers
ICTNUT Posted April 5, 2008 Posted April 5, 2008 (edited) Hi All, Have made great progress with this and it is ready so I just thought I would tempt you all with some screen shots of the server monitor The server monitor will do the following: Check any Windows Server acros multiple domains, providing a trust is in place Check any services that maybe on those Windows Servers You can add custom services to check, a handfull are already added for you If a server is added but no services assigned to it server is shown as offline If services are added to the server for checking but the service state is not Running or Stopped then the service is not displayed The server monitor is 100% web based and does not require any components to run Full web based admin is provided ITS FREE TO USE AS YOU WISH !!!!! You can download it from here -> My Little Server Monitor or click on the link in my sig at the bottom. Feedback would be great espcially if you want things adding to it. Edited April 5, 2008 by ICTNUT 3
russdev Posted April 6, 2008 Posted April 6, 2008 Just a quick bug fix... in \mlsm\incs in the db_connect.asp file line that reads : - strDataAndPath = server.MapPath("/data/netmon.mdb") Needs to be at very least strDataAndPath = server.MapPath("/mlms/data/netmon.mdb") Not ideally as that has hard coded url in..
russdev Posted April 6, 2008 Posted April 6, 2008 Also had to give internet guest account full access to the data folder (not just the access database) otherwise got a Could not use ''; file already in use. error message. Russ
russdev Posted April 6, 2008 Posted April 6, 2008 As for suggestions: - - Quick delete all services when deleteing a server. - Like in previous scripts above being able to add ?portal=true on to end of url and it displays words all systems ok or if problem then it displays the error etc.
russdev Posted April 6, 2008 Posted April 6, 2008 Also a add all services to a server button (then we can remove ones not installed) could save time.. Russ
ICTNUT Posted April 6, 2008 Posted April 6, 2008 (edited) Just a quick bug fix... in \mlsm\incs in the db_connect.asp file line that reads : - strDataAndPath = server.MapPath("/data/netmon.mdb") Needs to be at very least strDataAndPath = server.MapPath("/mlms/data/netmon.mdb") Not ideally as that has hard coded url in.. Hi Russ, Thanks for your feedback :-) The above is true if you add MLSM as a folder to an already established website, if however you add the folder as either a new site or a virtual directory the original should work fine. Ihave, however, made your suggestion as the default as most people with simply "plugin" to an existing site. Also a add all services to a server button (then we can remove ones not installed) could save time.. The above has been added Quick delete all services when deleteing a server. The above has been added Also had to give internet guest account full access to the data folder (not just the access database) otherwise got a Could not use ''; file already in use. error message. Ahh the perils of using access, Iam looking at doing a MySQL/MSSQL version in order to poll the servers and store the results in the DB. This would acheive 2 things 1) the main service display would no longer be a "live" link to the servers and thus remove the ability to perofm a potential DoS attack and in turn allowing you tomake the display page publicly available and 2) remove the issues of Access being very limited. Like in previous scripts above being able to add ?portal=true on to end of url and it displays words all systems ok or if problem then it displays the error etc. I'm looking at this now to see how it could be done. I have uploaded a new package containing the changes above. Edited April 6, 2008 by ICTNUT
mullet_man Posted April 6, 2008 Posted April 6, 2008 @ICTNUT Can this also check IP addresses e.g. for wireless and printers, or does it just do servers?
SYNACK Posted April 6, 2008 Posted April 6, 2008 @ICTNUT Can this also check IP addresses e.g. for wireless and printers, or does it just do servers? It could be added easy enough by integrating this this code.
ICTNUT Posted April 6, 2008 Posted April 6, 2008 (edited) @SYNACK & mullet_man: I am currently testing this as we speak :-) @SYNACK: The problem with that code is that you have to provide access to the system32 folder and certain files within it to the IIS guest account for it to run other wise you just get an "Access Denied" error. I do have an alternative option which I am working on so if you do not wish to query services on a server i.e wireless access point or *nix server you can Ping it BUT this does not mean that any of the services on said piece of hardware are responding just that the network card is. Edited April 6, 2008 by ICTNUT
mullet_man Posted April 6, 2008 Posted April 6, 2008 @SYNACK & mullet_man: I am currently testing this as we speak :-) Thats awesome
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now