You could create a simple web page with an address bar for the website and some javascript that uses AJAX to hit a site. If you get any HTTP response other than 200 on the async callback, the site isn't working html> Site To Check.
You could create a simple web page with an address bar for the website and some javascript that uses AJAX to hit a site. If you get any HTTP response other than 200 on the async callback, the site isn't working. Site To Check: This code depends on the browser not being IE and I haven't tested it, but it should give you a really good idea.
This is an interesting idea. How would I 'hit' a website with it though? Ie: would I load the site in the browser.
Would the fact that my internet providers site come up (road runner) still work? Do you have any code sample you could provide. Thank you very much for your response :-) – schmoopy Oct 13 '08 at 22:32 Added a code sample for you.
– IAmCodeMonkey Oct 13 '08 at 22:41 Thank you for the code sample. I will give this a try :-) – schmoopy Oct 13 '08 at 23:50.
Wget is a nice alternative. It will check not only whether the machine is active, but also whether the HTTP server is accepting connections.
Eg. Check the return code of wget foo.com/ -O - > /dev/null 2>&1 – Andrew Edgecombe Oct 14 '08 at 2:22.
To see if a service is up, not only should you ping, but it's good to have scripts that will hit a service, such as a website, and get back a valid response. I've used What's Up Gold in the past, rather than write my own. I like all the features in products like that.
Such as sending me a page when a service is down.
For the record, lkjsdaflkjdsjf. Com is a hostname (which at the moment is not registered to anyone). Ping does not work with URLs, ping works with hostnames.
Hostnames are looked up using the Domain Name System. DNS is supposed to fail when hostnames are not registered. The problem is that some services (apparently your ISP, and definitely OpenDNS) do NOT fail DNS requests for hostnames that aren't registered.
Instead they return the IP address of a host on their network that presents a search page to any http request. You appear to want to know two things: Is the name real (that is, is there a host with this name registered to some actual machine)? And Is that machine functioning?
If you already know that the name in question is real (for instance, you want to know if google.com is up), then you can use ping because you know that the name will resolve to a real address (the ISP can't return their IP for a registered name) and you'll only be measuring whether that machine is in operation. If you don't know whether the name is real, then the problem is harder because your ISP is returning false data to your DNS request. The ONLY solution here is to find a DNS server that is not going to lie to you about unresolved names.
The only way I can think of to differentiate between your ISP's fake records and real ones is to do a reverse lookup on the IP you get back and see if that IP is in your ISP's network. The problem with this trick is that if the ISP doesn't have reverse DNS info for that IP, you won't know whether it's the ISP or just some knucklehead who didn't configure his DNS properly (I've made that mistake many times in the past). I'm sure there are other techniques, but the fact that DNS lies underneath everything makes it hard to deal with this problem.
Very well put. I have however ping'd a real domain name, then stopped the web server, pinged it - and it returned open DNS's ip. I may try reverse as an added feature, but maybe I should use the domain name and IP address.
If ping returns a different IP I know its invalid.. hmmm – schmoopy Oct 13 '08 at 23:47 That's really...wrong. OpenDNS CAN'T be returning their IP just because your web server is down, it would kill the entire net. Are you sure you didn't take out your name server as well as the web server?
– Michael Kohne Oct 14 '08 at 14:17.
I've found ping to be very unreliable just because of all the hops you're having to jump through, and something in between can always interfere. Trying to open up an http connection with a web server is probably the best way to go.
You could try running 'httping' if you have cygwin available or freshmeat.net/projects/httping.
As far as I can see, the problem here that OpenDNS resolves invalid domains back to themselves to forward you on to something close to what you're after (so if you typo ggooggllee. Com you end up at the right place via a bounce from the OpenDNS servers). (correct me if I'm wrong) If that's the case, you should just be able to check whether the IP you've resolved == any of the IPs of OpenDNS?
No more ping - no protocol (HTTP) level stuff - just checking for the exceptional case?
If you tend toward the sys-admin solution rather than the programming solution you could install a local name server and tell it not to accept anything but NS records for delegation only zones. This was the fix I (and I assumed everyone else on the internet) used when Network Solution/Verisign broke this last time. I installed BIND on a couple of local machine, told my DHCP servers to hand out those addrs as the local name servers, and set up something like the following for each of the delegation only zones that I cared about: zone "com" { type delegation-only; }; zone "net" { type delegation-only; }; Come to think of this, I think this might be turned on by default in later BIND versions.As an added bonus you tend to get more stable DNS resolution than most ISPs provide, you control your own cache, a little patching and you don't have to rely on your ISP to fix the latest DNS attack, etc.
Don't directly know of any off the shelf options in c#, although I'd be very suprised if there aren't a few available. I wrote something similar a few years ago, don't have the code anymore cos it belongs to someone else, but the basic idea was using a WebClient to hit the domain default page, and check for a http status code of 200. You can then wire any notification logic around the success or fail of this operation.
If bandwidth is a concern you can trim it back to just use a HEAD request. For more complex sites that you control, you can wire up a health monitoring page that does some more in depth testing before it sends the response, eg is DB connection up etc. Often a machine that is dead on port 80 will still respond to a ping, so testing port 80 (or whatever other one you are interested in) will be a much more reliable way to go.
I like CALM for this sort of thing as it logs to a database and provides email notifications as well as a status dashboard you can set up a test page on the site and periodically do a GET on it to receive either a 'true' result (all is well) or an error message result that gets emailed to you caveat: I am the author of CALM.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.