The Sysadmin's Daily Grind: HTTPing

Web Check


HTTPing may be the perfect tool to check on the health of your web server.

By Charly Kühnast

Airbus SAS 2005

Between visits to the dentist, my job depends on my users' subjective impressions. If a web server reacts slowly, the typical reaction is something like "Hey, why's the server so slow today?" But how "slow" is slow? If a single machine is having a bad day, it is quite simple to individually check its health state. Things start becoming more complicated if a remote machine is off-key and I only have HTTP access.

Monitoring software applications such as Smokeping are not the kind of quick solution I need, and nor do I need Wget, Netstat, and Time. HTTPing [1] is the most elegant tool for the job. It sends GET or HEAD requests to the stricken web server and logs both the responses and the trip time. HTTPing's name comes from syntactical similarities between its command line options and those of ICMP ping. In the simplest case, I just pass a URL to HTTPing and send it on its way: httping -g http://kuehnast.com. In this case, HTTPing will send one HEAD request per second to the specified server until I press [Ctrl]+[C] to tell it to stop. The output looks like Listing 1.

Listing 1: httping -g
01 PING kuehnast.com:80 (http://kuehnast.com):
02 connected to kuehnast.com:80, seq=0 time=8.57 ms
03 connected to kuehnast.com:80, seq=1 time=3.56 ms
04 connected to kuehnast.com:80, seq=2 time=4.24 ms
05 --- http://kuehnast.com ping statistics ---
06 3 connects, 3 ok, 0.00% failed
07 round-trip min/avg/max = 3.6/5.5/8.6 ms

Is Encryption to Blame?

Even this trivial test tells me if, and how quickly, the server responds. The -G parameter lets me specify GET requests, rather than HEADs. I can specify -l to see what effect using HTTPS has on the server access times. Listing 2 shows the effect that SSL encryption has on the response times. I'm also interested in the status code returned by the server. Besides the typical 200 OK, I want HTTPing to evaluate Code 304 Not modified as a successful Connect:

httping -s -o 200,304 -G -l -g https://kuehnast.com

As previously mentioned, some HTTPing option have the same effect as with ICMP echo requests: the -i parameter sets the interval between individual connection attempts in seconds. Values of less than one second, 0.5 for example, are interpreted by HTTPing as meaning "as often as possible." The -f ("flood") parameter has the same effect. This said, flooding a web server doesn't make much sense, and it can put a strain on your relationship to the web server admin.

The -c 10 lets me restrict the whole text to ten requests and avoids the need to press [Ctrl]+[C] to quit HTTPing. Timeout control can be important if you use a script to launch HTTPing. By default HTTPing times a connection out after 30 seconds. I tend to set this value to ten seconds (-t 10), as shown in Figure 1. After all, a web server that doesn't respond within ten seconds definitely has a problem.

Listing 2: httping -G -l -g
01 # httping -G -l -g https://kuehnast.com
02 [...]
03 connected to kuehnast.com:443, seq=0 time=96.33 ms
04 connected to kuehnast.com:443, seq=1 time=95.38 ms
05 connected to kuehnast.com:443, seq=2 time=95.14 ms
06 [...]
INFO
[1] HTTPing: http://www.vanheusden.com/httping/
THE AUTHOR

Charly Kühnast is a Unix System Manager at the data-center in Moers, near Germany's famous River Rhine. His tasks include ensuring firewall security and availability and taking care of the DMZ (demilitarized zone).