Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Services to monitor and report if a web site goes down?

I've had an interesting day. I've been with a hosting company for 8+ years without a hitch. Today the MySQL on my server failed without any real reason. I had no idea so my site was down for 3 hours and of course I got emails from customers wondering what had happened. Not fun.

What are ways to ensure my site is always live? It would be great if I got a text message saying it's down. Are there any practical things that one should do to ensure their site is performing?

share|improve this question

migrated from stackoverflow.com May 28 '12 at 12:03

This question came from our site for professional and enthusiast programmers.

marked as duplicate by John Conde May 28 '12 at 17:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Get a website monitoring account, such as one from pingdom.com (there are loads of such firms, some of them free). Some will send you an SMS if the service is down, which is good for speedy notification. – halfer May 27 '12 at 13:22
You could also move to a cloud service, which essentially will move your site transparently if a single node goes down - it depends what you have at the moment, and what your budget is. Are you running a shared/VPS/dedicated box? What OS? – halfer May 27 '12 at 13:24
This is relevant: serverfault.com/questions/316637/… – Ben May 27 '12 at 13:31
@Ben - I was just about to post that question. :-) – Anonymous May 28 '12 at 14:19
up vote 1 down vote accepted

http://www.pingdom.com/ or http://newrelic.com are both really good services!

share|improve this answer

I use this Perl script to monitor all the services on my production server


use SendMail;
use IO::Socket;

#Find Server IP

@downservice = ();
@services = ( 'nginx', 'apache2', 'mysql' );
foreach my $service (@services) {
my $status = `/bin/ps cax | /bin/grep $service`;
if (!$status) {
     push (@downservice, $service);

$sm = new SendMail("EmailServer");
$sm->setMailBody("The Following Services are Down { @downservice } in Server $addr");

# Check if the mail sent successfully or not.
if ($sm->sendMail() != 0) {
  print $sm->{'error'}."\n";
  exit -1;
# Mail sent successfully.
print "Done\n\n";
exit 0;

The Script is added to the cron job and runs every 5 mins is a service is down it send's email alert

share|improve this answer
and how do you detect whether your script is running or your mail server? – Del Pedro May 28 '12 at 11:33
To Check my mail service is running i look for the postfix service – Rakesh May 28 '12 at 11:45

Have been using IP Sentry since it first came out on single server operations up to load balanced enterprise situations. Can't say enough good about it.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.