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.
-
Ancient, but, very simple and easy and does very basic checks.
http://www.angio.net/consult/autostatus/
From karmawhore -
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.
Edit:
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.
acidzombie24 : pingdom appear to only allow 1 free month. No option for unlimited (or lesser featured) one free site monitoring.David Spillett : 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.From David Spillett -
If you are referring to services and not the server itself, I have used Monit in the past for single server set-ups.
From Nathan Powell -
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.
From gtirloni -
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.
From Toucan -
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.
From symcbean
0 comments:
Post a Comment