well somehow apache on my vps server automatically stops and my sites stops loading until I restarts the server. I am still trying to debug the problem but was wondering is there anyway I can know immediately when the server gets down. May be some script or some online service which monitors such things. Cheers
sitemonitor is the keyword to search for. Lots of sites offer it. Some offer a free service that checks like every 15 or 30 minutes, have to pay for more frequent checks. http://www.siteuptime.com/ http://host-tracker.com/
Try Pingdom. They have a free trial with free SMS, using them at the moment, and they're great. They use multiple locations too, but I'm not affiliated with that if that's what you're thinking
I use to use a site called SiteUpTime.com Alternativly, if you have a server elseware which has PHP enabled, you can here a tutorial here. Thanks
The best you can find to monitor your http as well as the result timing using wormly. It will give you a small chart regarding the http TCP, EXEC, Transfer timing which is very helpful to understand what was, is the status of your web server. Checkout http://www.wormly.com
You can buy another server and put a script on it like <?php if(!fsockopen("domain ip",80)) die("offline"); else die("online"); ?> Or you could make it so if its offine it emails everyone from your email database (Which you'll have backed up on the other server) saying its offline and will be on soon or something.
Make sure your host doesn't offer the feature. The good ones do. Here is also free stuff I found: http://basicstate.com/ (looks great) http://www.servermojo.com/ (beta but might be worth trying) http://host-tracker.com/order-page/ (has a 30 minute interval for free and paid versions too)
below you already got all the useful advice what you can do on a long time basis for permanent uptime control is to team up with friends owning another site / server and watch each other's server using any of above scripts in addition to eMail notification to your MOBILE device eMail box you may also consider setting up or connecting to an SMS portal that sends you a SMS "server down notification" to your mobile and if you love high tech and smart phones you may even use any of the high end smart phones such as the Nokia N95 or comparable phones that allow www connection and possibly ssh connection to your server - thus allowing you to instantly restart your apache from your mobile. to find your current cause for server stop - study your error_log and your /var/log/messages and /var/log/warn as well. search for events just preceding by seconds your apache stops. also check your access_log for last accesses just the seconds before your apache stops to see if a particular script or visitor action causes apache to stop.
There are some firms that offers such service, For exapmple, siteuptime, mon.itor.us, etc. I am using mon.itor.us personally and satisfied with them.
I have tried them all and yes Pingdom is the best, it's got the best graphs, interface etc and you can also monitor MySql as well as DNS along with HTTP, response time, ports, email etc. Monitoring MySql is important, a lot of monitors don't check this and if it fails you won't know because the server is technically still responding via regular pings.
On VPS typically this problem occurs when your load spikes and your host VPS service automatically kills the apache process for using too much cpu and/or memory. If you adjust your apache configuration to spawn less children and accept less total volume of requests at once then this will stop happening. You could also increase your VPS specs to keep this from happening. The best way to monitor a server would be with a program such as Nagios, that has the ability to alert you when your server goes offline through a variety of methods.