Bengaul Posted March 13, 2008 Posted March 13, 2008 Hi, I have been looking on the net for a short while for some software that will monitor a few key servers, and their services, then give a simple readout that I can display on a helpdesk web page. For example, I could monitor Exchange and POP and a display on helpdesk would simply read: Email = OK Nagios, Zenoss etc. all seem overkill, and I seem to be unable to visit the web pages without some sort of logon. Any help appreciated, Bengaul
FN-GM Posted March 13, 2008 Posted March 13, 2008 This will check if your servers are online, probably not what you are after http://www.edugeek.net/wiki/index.php/Check_the_status_of_your_servers
kmount Posted March 13, 2008 Posted March 13, 2008 Hi, We have a simple php page which supports PING & Socket connections to key ports ... IE, we monitor DNS simply by checking its 'responding' on the correct port. Not fool proof but works enough for us.
FN-GM Posted March 13, 2008 Posted March 13, 2008 kmount, that will be handy for the intranet. If you wouldn't mind passing it on. Thanks
russdev Posted March 13, 2008 Posted March 13, 2008 Yes if could post that up kim would find it useful. Russell
Bengaul Posted March 13, 2008 Author Posted March 13, 2008 Hi, We have a simple php page which supports PING & Socket connections to key ports ... IE, we monitor DNS simply by checking its 'responding' on the correct port. Not fool proof but works enough for us. That is the sort of thing I am after. It is simply so people can check the status of the network themselves. It need not be fool proof, but at least if our connection to the net is down, it would be simple for people to check if it is local to their machine or network wide, for example.
Bengaul Posted March 13, 2008 Author Posted March 13, 2008 I found this: http://www.uptimescript.com/demo.php seems to do the job, but is $20.
powdarrmonkey Posted March 13, 2008 Posted March 13, 2008 You can have guest access to Nagios, and its overview page and map pages are pretty good for visualising.
Nick_Parker Posted March 13, 2008 Posted March 13, 2008 In the Bishop Barrington script (Which is just what I'm looking for!) I don't understand the line: "ping $host -c 1 -w 1" I assume it runs that like a normal ping in command prompt, but the PING command in command prompt doesn't accept a -c command?
powdarrmonkey Posted March 13, 2008 Posted March 13, 2008 I don't understand the line: "ping $host -c 1 -w 1" Looks like the GNU/Linux ping syntax to me.
webman Posted March 13, 2008 Posted March 13, 2008 Correct, it is Linux ping command which is slightly different to Windows; which would be: ping $host -n 1 -w 1 but the output and/or return value will be different so the PHP ping() function might need changing.
Joedetic Posted March 14, 2008 Posted March 14, 2008 Yeah someone wrote something for me a while back which could be damn useful for me to integrate into an intranet (seeing as i don't know how to script/program) was written in php using sockets to check different services...i can even define none-standard ports for services etc.
Sirbendy Posted March 14, 2008 Posted March 14, 2008 I've been fiddling on a local Apache install, and tried errorlevel returning (1/0), tried shell_exec'ing and parsing output..nothing. Typically, it's my missus day off..she loves PHP fiddling.
Guest blacksheep Posted March 14, 2008 Posted March 14, 2008 Use this to execute commands: system (PHP 4, PHP 5) system — Execute an external program and display the output http://uk3.php.net/manual/en/function.system.php
christhack Posted March 17, 2008 Posted March 17, 2008 Has anyone had any joy getting this working on a Windows IIS server? I just seem to get all my server listed as down.
webman Posted March 17, 2008 Posted March 17, 2008 For Windows you will need to grab the output of the ping command and parse it. We don't run PHP on Windows here so I can't help I'm afraid.
PEO Posted March 17, 2008 Posted March 17, 2008 For Windows you will need to grab the output of the ping command and parse it. We don't run PHP on Windows here so I can't help I'm afraid. idot guide? so raher than have "ping $host -c 1 -w 1" you mean change to just "ping $host" ?
webman Posted March 17, 2008 Posted March 17, 2008 Not exactly. You only need to send one packet, and you can adjust how long you want the timeout. For example: ping hostname -n 1 -w 500 Will ping 'hostname' once and wait a maximum of 500ms for a reply. You will need to get the output from this command and parse it to see if it was successful. Ping failures will contain "Request timed out." and successful pings will have something like "Reply from " in them. 1
zag Posted March 18, 2008 Posted March 18, 2008 (edited) To get it working on IIS/Windows Change these 2 lines. Its just because windows returns a different message when a ping fails. $rv = exec( "ping $host -n 1 -w 1" ); if( $rv != "Ping request could not find host ". $host . ". Please check the name and try again." ) { This only works for named servers though and not the IP address as it comes back with a different reply. I will see if I can modify it later. Edited March 18, 2008 by zag
christhack Posted March 18, 2008 Posted March 18, 2008 If you want to use this on IIS/Windows and use IP addresses rather than named hosts you can use these lines in the ping function. $connect = " Packets: Sent = 1, Received = 0, Lost = 1 (100% loss)," ; $rv = exec("ping $host -n 1 -w 1"); if( $connect == $rv ) You could combine this with the previous guys post to cover named servers and IP addresses.
christhack Posted March 18, 2008 Posted March 18, 2008 Here is the combined code to cover using an IP address or a named server. 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; } } } Just replace the whole of the ping function in the original code. 3
zag Posted March 18, 2008 Posted March 18, 2008 I went a bit far with this Looks cool though! http://img167.imageshack.us/img167/549/statusoi4.th.jpg
Sylv3r Posted March 18, 2008 Posted March 18, 2008 That does look good and thats what I want to be able to do with ours. It will prove useful on our AP's and printers.
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