开发者

Is pinging to a site a good way of checking whether it's down or not?

开发者 https://www.devze.com 2023-02-01 13:42 出处:网络
I\'m trying to write a small website monitoring program, that can check my web hosts to see whether they are down or not, and to calculate the uptime or warn me if it\'s down. It\'s going to be a sta开

I'm trying to write a small website monitoring program, that can check my web hosts to see whether they are down or not, and to calculate the uptime or warn me if it's down. It's going to be a sta开发者_运维百科ndalone app.

I wanted to know whether pinging is a good way of finding out whether a site is down or not?

Thanks in advance.


That's one thing that you can do but it's by no means a certainty either way.

Some sites will ignore ICMP packets so that no ping response is given. Some sites will respond to pings even when the web server (or whatever service you're after) is down.

The only way you can be certain that a given site will provide a service is to, well, use that service. Nothing else will be as accurate.

A better method would be to provide a series of steps which would detect where a fault lay, at least in the infrastructure that you can control. For example:

  • allow pings to be received and acted upon.
  • have a static web page in the web server.
  • have a dynamic page in the application server which delivers static content.
  • have a dynamic page in the application server which uses the database.

Then your tester client would simply attempt to "contact" those four points and report on the success. Since you would expect your site to be up most of the time, I'd just check the fourth option to see if everything was okay, and do the other checks only if a problem were found.


It depends on how you define ping. If you're talking about the "low level" ICMP echo, then no it isn't likely to be a good indicator of whether or not your site is down. You would be better off to actually have an application pull a page down from your site to ensure that the HTTP server is running. There are plenty of services for this and likely some code you could download from google as well. http://www.dailyblogtips.com/test-if-a-website-is-down-for-everyone-or-just-for-your/


ICMP can prove the server is alive.

TCP checking can show the web server is working, but not the site.

To perform site checking, you should do http GET request(even HEAD doesn't work sometimes) to make sure the page was fine.(return status 200)

You can write your own checking system or use some third party site like http://allping.net/


ping gives you insight in latency from a specific location and also points to possible network issues (packet loss). As said in a previous answer, some servers don't respond to ping requests in which case ping is useless. To check a server with ping from over 50 locations worldwide have a look at this free tool: http://just-ping.com/

0

精彩评论

暂无评论...
验证码 换一张
取 消