views:

197

answers:

5

I'm looking for a way to find out how long a server has been up based only on the page it sends back. Like, if I went to www.google.com, is there some sort of response header variable that tells how long the server I connected to has been up? I'm doubting there is, but never hurts to ask...

+4  A: 

No, because HTTP, as a protocol, doesn't really care. In any case, 50 different requests to google.com may end up at 50 different servers.

If you want that information, you need to build it into the application, something like "http://google.com/uptime" which will deliver Google's view of how long it's been up - Google will probably do this as a static page showing the date of their inception :-).

paxdiablo
+2  A: 

Unfortunately there really isn't. You can check this for yourself by requesting the HTTP headers from the server in question. For example, from google.com you will get:

HTTP/1.0 200 OK
Cache-Control: private, max-age=0
Date: Mon, 08 Jun 2009 03:08:11 GMT
Expires: -1
Content-Type: text/html; charset=UTF-8
Server: gws

Online tool to check HTTP headers:

http://network-tools.com/default.asp?prog=httphead&host=www.google.com

Now if it's your own server, you can create a script that will report the uptime, but I don't think that's what you were looking for.

Dave Forgac
A: 

To add to what Pax said, there are a number of third party services that monitor site up-time by attempting to access server resources at specific intervals. They maintain some amount of history in their own databases, and then report back to you when those resources are inaccessible.

Josh
+3  A: 

Not from HTTP.

It is possible, however, to discover uptime on many OSs by interrogating the the TCP packets received. Look to RFC 1323 for more information. I believe that a timestamp header is incremented by some value with every transaction, and reset to zero on reboot.

Caveats: it doesn't work with all OSs, and you've got to track servers over time to get accurate uptime data.

Netcraft does this: see here for a vague description:

The 'uptime' as presented in these reports is the "time since last reboot" of the front end computer or computers that are hosting a site. We can detect this by looking at the data that we record when we sample a site. We can detect how long the responding computer(s) hosting a web site has been running, and by recording these samples over a long period of time we can plot graphs that show this as a line. Note that this is not the same as the availability of a site.

Michael Petrotta
A: 

I use Uptime Party for monitoring a server.

Alan Haggai Alavi