wget timeouts

I finally resolved another outstanding problem that has been bothering
me for a long time. It’s funny that I didn’t try this experiment
sooner, however I just happened to stumble on this earlier today.

I write a lot of scripts that I use with mrtg. In many of my scripts I use the wget
utility to fetch a web page, and then I “scrape” the web page for the
data that I want mrtg to graph. When I started to do this, I
noticed that when the target device was down, it would take wget a long
time to timeout. In reading the man page, it said to use the “-T”
option to set a shorter timeout. I tried all sorts of values, but
was not able to shorten the timeout to seconds.

Today, while reading a variety of web pages, I found that there is a “-t” (note the lower case!) option that sets the retries.
I don’t know – and can’t find – what the default number of retires is,
but by updating my scripts to have “-t 1 -T 10” I am now getting a 10
second timeout!

So it seems that my problem was not the timeout, but instead the number
of times that wget was retying the request! I have posted my
updated NoCat Gateway Monitoring script that contains the fix. Now I’m going to go and update more of my scripts!

Leave a Reply