Re: Checking if a host is online

From: Date: Sun, 30 Nov 2003 00:10:22 +0000
Subject: Re: Checking if a host is online
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-171374@lists.php.net to get a copy of this message
This may be OT but have you looked at Netsaint (http://www.netsaint.org/ and http://www.netsaint.org/indexold.php), now called Nagios (http://www.nagios.org/) by the looks of it. Note: It's not written in PHP from what I remember. You may be able to get some ideas from it or even use it. I've used it in the past to monitor a small web cluster and it worked nicely. Additionally, freshmeat has a bunch of network monitors listed written in PHP. Jason Giangrande wrote:
I'm creating an application for an Intranet that, among other things, is supposed to check to see if particular hosts are online, and if so, what their IP address is. Anyone know how I can accomplish this? I tried using exec("host $host"); (where $host is the hostname) and while this gets the IP it gets the IP address sometimes even if the host is not active, because a DNS record for the system still exists. I also looked into the gethostbyname() function, but that has similar problems to using the external host command. I also tried to use an external ping command (ping -c 1 $host), and while I could get that to work, since it returns non-zero status if the host can not be contacted, it takes quite a while to execute for even a few hosts at once. Anyone ever do this king=d of thing before or have any suggestions on what might work?
-- "No, mon, let's go home to Jamaica. I and I been in Babylon too long." -- Homer Simpson

« previous php.general (#171374) next »