Mar 9
Squid URL Ping
icon1 admin | icon2 Squid | icon4 03 9th, 2008| icon3No Comments »

Squid Cache

Squid can be difficult to debug, especially if you have a URL which sometimes works and sometimes doesn’t. Fortunately, “squidclient” comes with a ping mode which allows you to ping a web url through the cache and see throughput, page size and time to download.

Below is an example of the output from the default command –

2008-03-09 20:14:04 [1]: 3.951 secs, 6.968667 KB/s (28KB)
2008-03-09 20:14:08 [2]: 4.296 secs, 6.408350 KB/s (28KB)
2008-03-09 20:14:12 [3]: 4.257 secs, 6.467060 KB/s (28KB)
2008-03-09 20:14:16 [4]: 4.200 secs, 6.555757 KB/s (28KB)
2008-03-09 20:14:20 [5]: 3.966 secs, 6.942557 KB/s (28KB)

To do this run squidclient -r -g 10 http://www.unixtrix.net . The -r forces the cache to fetch the url each time (e.g. not a cached copy). The -g 10 tells squidclient to fetch the url 10 times, you can set this to 0 to continuesly ping.

If your proxy requires authentication you can use -u username and -p password or optionally if the website url you are requesting requires authentication you can use -U username and -P password.

Using -I interval will allow you to set the interval it should ping at. For example, -I 60 will send one request a minute. Below is an example using these tips to check our connection to http://www.google.com every 10 seconds until interrupted –

 # squidclient -r -I 10 -g 0 http://www.google.com
2008-03-09 20:11:56 [1]: 0.687 secs, 0.958083 KB/s (1KB)
2008-03-09 20:12:06 [2]: 0.346 secs, 1.902321 KB/s (1KB)
2008-03-09 20:12:16 [3]: 1.066 secs, 0.617451 KB/s (1KB)
2008-03-09 20:12:26 [4]: 0.353 secs, 1.864598 KB/s (1KB)