Forum Moderators: coopster

Message Too Old, No Replies

Server Uptime

monitoring server uptime using Php script

         

kenchix1

10:49 am on May 9, 2007 (gmt 0)

10+ Year Member



I have several websites and I wanted to monitor the uptime using a single page from another website then I wanted to save the report on MySQL database.

Is it possible to monitor server/website uptime using PHP Script? If yes, does it really consumes a lot of bandwidth? What are the important parts that I should look into?

There are lots of online monitoring software out there but they only offer a few URL to monitor.

any advice please?

thanks in advance.

phparion

11:46 am on May 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



will you host the script on the same server as the monitored sites are? or different server? explain monitoring further e.g checking if any page goes down, timeout conditions, number of mysql queries, number of processes etc etc?

kenchix1

5:43 am on May 10, 2007 (gmt 0)

10+ Year Member



I plan to host the monitoring software on another server. I only wanted to see if the site goes down, number of MySQL connection and if possible the Memory and CPU state. It's important for me to know if the site goes down and what time it happened.

could this be done using PHP?

Thanks in advance.

kenchix1

5:44 am on May 10, 2007 (gmt 0)

10+ Year Member



BTW, I wanted to the software to check the sites every 15-30 minutes.

jatar_k

12:37 pm on May 10, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



try [nagios.org...]

joelgreen

12:29 pm on May 11, 2007 (gmt 0)

10+ Year Member



In order to check uptime you could use sockets and check status. This is a few lines php script.

$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
}

does it really consumes a lot of bandwidth

depends on how often you are checking. Above code will not load page from the server, it will only try to connect to the server. So load is minimum.

Some uptime trackers allow too check if some string present on target webpage. In this case script will have to load page text, and will consume more bandwidth.