Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

What is the easiest way to check if the server is down? not using a 2nd server or my home computer. Preferably self detection.

I was thinking of having a cron job use libcurl every few minutes to download the page and see if there is an error or not.

share|improve this question
How do you propose to have a system reliably detect if it is down itself if one of the hung components is required by your detection routine? – RobM Jul 10 '10 at 8:51
@Robert Moir: Have it write to a file every minute. Have an app visit the site. Then maybe have curl hit proxy outside and see if it can connect. If the file is missing for a few minutes, the system is down. If it cannot visit itself something weird is happening. If curl cannot reach the outside, the network is probably down and etc. – acidzombie24 Jul 10 '10 at 10:28
Those are valid ways of testing whether or not a server is up, though they all fail the "reliability" part of the equation - your method can be beat by the fault you are hoping to detect if they are run on the same server. They also suffer from not testing all issues - knowing whether or not the server can write to a file or display a simple page isn't the same as knowing an app is working. Of course, perhaps you don't need perfection, just "good enough". In which case don't get hung up on the reliability issue, but I'd still take it into account when choosing how much to rely on the tests. – RobM Jul 10 '10 at 10:39
You CANNOT reliably monitor a machine by using that same machine. In your situation if the machine or critical services are down and that file is not created the system will also be unable to alert you to that fact, making the entire "monitoring" system useless. You really haven't thought this through at all. – John Gardeniers Jul 10 '10 at 10:53
And with a proper monitoring system you'll see the same thing in real time. – John Gardeniers Jul 10 '10 at 13:48

You are not going to arrange reliable self-detection. A machine can log "yep, I seem to be here" but it won't be able to log if it is off or completely hung as it will be, well, off or completely hung. Also you can check that your webserver is running locally, and would be able to log a network outage that affects everything the server can see (by requesting objects from the outside world with libcurl,or just sending out ping requests) but you'll not be able to detect a finer grained fault that stops apache being visible to the outside world.

There are many cheap monitoring services out there though and some, like pingdom, offer free accounts that you can monitor one service with. I would suggest you try something like that.


As per the discussion in the comments attached to your question, there are many tools that allow a machine to monitor its own status as well as (or instead of others). I use collectd (found in the Debian and Ubuntu standard repositories, and probably similarly easy to get hold of in other distros) to collect data on CPU load, I/O load, memory use and many other variables and a slightly modified version of this cgi script to draw graphs of the resulting datasets. Useful for monitoring oddities like the inexplicable CPUD load increase I seen VMWare VMs impose (which goes away once you reboot the VM, only to slowly climb back up again). There are a number of similar tools so you should be able to find one that operates close to how you want it too. collectd has many built-in plugins and you can write your own in C, perl or just a shell script if you need something that isn't there as standard.

I'd still recommend an external monitor too though, given several providers will monitor one server at a reasonable frequency for nothing.

share|improve this answer
pingdom appear to only allow 1 free month. No option for unlimited (or lesser featured) one free site monitoring. – acidzombie24 Jul 10 '10 at 19:28
I think the 30 day free is for the 5 and 30 services monitored services, unless of course it has changed since I signed up for my free single service monitor which is still running more then two months from start. – David Spillett Jul 10 '10 at 23:27

If you are referring to services and not the server itself, I have used Monit in the past for single server set-ups.

share|improve this answer

Ancient, but, very simple and easy and does very basic checks.

share|improve this answer

You should describe what exactly "downtime" means in your specific situation.

If you are only interested in the health of an application running on a single server, running tests that ensure that application has access to all the resources it needs in order to be "up" will probably warn you when something is wrong.

If it's network connectivity that you're interested in, you could write an agent that checks interface status (up/down, link speed, etc) and intermediate nodes. But if it's down, it's down.. the server won't be able to report.

So there are a lot of IF's in your question. Your should take the time to objectively determine what exactly are you interested in monitoring and go from there. You'll probably find a few situations that can't be monitored without the aid of a 2nd server.

share|improve this answer

What are you aiming to do with this data?

If it's some sort of end of month audit/report, then you could easily write a perl script that logs every minute to a file/database if it's up and whether it could connect to the internet.

If it's to alarm you that the server has failed, then you'll need some sort of external service.

share|improve this answer

As usual, the big question here is what are you trying to achieve?

Despite what has been suggested by others - it is possible to have a machine measure its own availability - and there are hardware tools out there specifically designed to ensure good uptime without remote monitoring (have a google for watchdog cards).

What are the constraints on the monitoring?

Can you install hardware? Do you have root access? Is this a hosted machine somewhere? Do you have an SLA with the service provider?

The big problem with monitoring is that you end up monitoring not only the target, but the connection between the target and the monitoring and the monitoring system itself.

share|improve this answer

A lot of people have an iPHone now so here is another idea and is built on the following concept, Basically, DDWRT on your router which monitors your server. Then the iPhone will interface regularly with your router for health data. Obviously, there are also extra utilities in the iPhone to allow for further diagnostics should issues arise. I've seen an Android port as well but it seems to be unreliable. Given the speed of development in the smartphone world I wouldn't be surprised if there are already other viable alternatives though.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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