what I know about whatever the linux equivalent of batch would fit on the head of a pin,
I need a quick script to repeat and record the query time on dig queries in a file and echo it to the screen. , like once a minute, its the most reliable way I can see of recording and mesuring the latency/packet loss on our internet connection.
can you make dig bypass local dns? when our internet connection is "having problems" a manual query to an new domain jumps to around 2500ms
local queries are 6ms, normal query time to new dom is 40-150ms
anyone can write this for me please? thx

Short answer, yes you can tell dig to use any DNS server you wish.
dig @dnsserver domainname | grep "Query Time"
That'll return the time taken for the request but I suppose if you had a list of domains we'd be able to have it return the name of the domain in question and the time taken for the query.
To be honest though, 40ms is a long old time for an external resolution letalone 150ms! I'm averaging around 24ms here (when testing what I put above) .

@kmount: I think you have a typo
The command is dig @dnsserver domainname | grep "Query time" (lowercase 't')
I get between 5 and 20 msec.
I would do something like
Code:while (true) ; do dig whatever | tee -a /tmp/some_logfile sleep 60 done

I would put this in a cron job every minute (much neater, survives reboots):
Code:* * * * * dig {your query} | grep -i "query time" >> /var/log/dig.log
There are currently 1 users browsing this thread. (0 members and 1 guests)