browolf Posted March 4, 2009 Posted March 4, 2009 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
kmount Posted March 4, 2009 Posted March 4, 2009 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) .
Ric_ Posted March 4, 2009 Posted March 4, 2009 @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.
powdarrmonkey Posted March 4, 2009 Posted March 4, 2009 @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. or use case-insensitive grep: dig@dnsserver domainname | grep -i "QuErY TimE"
unixman Posted March 4, 2009 Posted March 4, 2009 I would do something like while (true) ; do dig whatever | tee -a /tmp/some_logfile sleep 60 done
powdarrmonkey Posted March 4, 2009 Posted March 4, 2009 I would put this in a cron job every minute (much neater, survives reboots): * * * * * dig {your query} | grep -i "query time" >> /var/log/dig.log
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now