DNS Server Response Time: Script & Templates

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

rsommerhalder
Posts: 2
Joined: Sat Feb 05, 2005 2:25 pm
Location: Switzerland

DNS Server Response Time: Script & Templates

Post by rsommerhalder »

Here is my tiny contribution to this great suite of Open Source monitoring tools which I use extensively to monitor my home systems, as well as a large ICT infrastructure of a major humanitarian organisation.

I implemented DNSResponseTime to measure the response times of multiple internal and external DNS Resolvers. The Perl script launches queries repeatedly (after holdoff delay between queries) during Cacti default sample intervall of 300 seconds and the returns minimum, median, average and maximum response times.

Upon import, the attached .XML file will create both a Data Template and a Graph Template called "DNSResponse" for Data Source, as well as a Data Input Method with the same name.
The Graph Template is in so far special as it features a "peak hold" function in in order to avoid peak values of the daily view to average out in the weekly/monthly/yearly views (see attached weekly screenshot).

Rolf
Attachments
cacti.png
cacti.png (16.52 KiB) Viewed 87000 times
dnsresponsetimeloop.txt
Place as dnsResponseTime.pl into /home/cactiuser and make sure it has the correct chown, chgrp and access rights.
(3.92 KiB) Downloaded 10944 times
cacti_graph_template_dnsresponsetime.xml
Import into Cacti through Web interface, will create the templates.
(20.12 KiB) Downloaded 10338 times
xpyros01
Posts: 2
Joined: Thu May 19, 2005 9:48 am

Re: DNS Server Response Time: Script & Templates

Post by xpyros01 »

Hi,

I have this script working and I have to say that it's a really nice script, good job!

Regards.
aboyz

hi.

Post by aboyz »

Can someone tell me what is the benefit of this. DNSResponseTime to measure the response times of multiple internal and external DNS Resolvers

Can someone explain it more clearer for me. Like give me an example.

Thanks.
laffen
Cacti User
Posts: 56
Joined: Tue Jul 13, 2004 2:57 am
Location: Norway

Re: hi.

Post by laffen »

aboyz wrote:Can someone tell me what is the benefit of this. DNSResponseTime to measure the response times of multiple internal and external DNS Resolvers

Can someone explain it more clearer for me. Like give me an example.

Thanks.
How fast your nameservers answer a lookup. Which can be useful info.
Delta
Posts: 3
Joined: Sat Jul 09, 2005 8:02 am
Location: Bucharest; Romania
Contact:

Post by Delta »

I have a small problem, Cacti is generating the graph but they are empty. In debug mode rrdtool says ok, in the pool logs he is accesing the right script (\home\cactiuser\dnsResponseTime.pl ), but not a single scratch in the graph area. What did I forget ?
To be or not to be ...
xpyros01
Posts: 2
Joined: Thu May 19, 2005 9:48 am

Not generating graphs

Post by xpyros01 »

Delta ->

I had the same problem with some scripts that I made, about lm_sensors voltages, and cpu/system/hard disk temperatures, and the problem was the owner of the scripts, I think that the owner should be cactiuser/users, so check the owner of the files contained on the dirs /rra and /scripts inside /var/www/cacti, and check the owner. At least that solution solved my problem and now it's working perfectly.

I hope that this help with your problem.

Regards.
Delta
Posts: 3
Joined: Sat Jul 09, 2005 8:02 am
Location: Bucharest; Romania
Contact:

Post by Delta »

The script is in the /home/cactiuser/ and has the right cactiuser group users. I think maibe the pearl script does not work. I see that in /www/cacti/scripts the files belong to root in group users. Those that come with cacti by default works perfectly.... :o
To be or not to be ...
Delta
Posts: 3
Joined: Sat Jul 09, 2005 8:02 am
Location: Bucharest; Romania
Contact:

Post by Delta »

I have discovered the problem. The script name was dnsResponseTime.pl so cacti could not find it. I have rename it in dnsResponseTimeLoop.pl and now is drawing something on the graphs but I don't know if those are the true values. The graph shows on all values number -2.00 K and does not move from this point.:cry:

"Description:
Place as dnsResponseTime.pl into /home/cactiuser and make sure it has the correct chown, chgrp and access rights. " This was the problem :wink:
To be or not to be ...
Linuxfreak_be
Posts: 22
Joined: Sun Sep 04, 2005 3:30 am
Location: Belgium

Post by Linuxfreak_be »

hi people,

i get this error
Can't locate object method "using" via package "TCP" (perhaps you forgot to load "TCP"?) at ./dnsResponseTimeLoop.pl line 85.
now what's up with that ?
wan-geek
Posts: 7
Joined: Thu Sep 22, 2005 4:26 pm

perl script

Post by wan-geek »

Do you have all the requesite perl modules installed???

Opening up the script (good work by the way!), you will see the following perl modules called:
----------------------
use Net::DNS;
use Getopt::Long;
use Pod::Usage;
use Time::HiRes;

If these are not functioning on the system, you are not going to get any results. The script cannot run unless all the called functions are installed and working.

There's a good number of google references to help get CPAN up to date and running on your system first. This is always a good thing to have installed.

Cheers,
-Chris
wan-geek
Posts: 7
Joined: Thu Sep 22, 2005 4:26 pm

Negative response values

Post by wan-geek »

First off, great work. I love the ease of integration. This rounds off our install of cacti nicely.

Second question though, (before I present this to mgmt.)...how is it that we get negative response results? Is there perhaps a respone time of 0 being handled improperly?

I just need to understand why I see negative values for min and occasional avg. so i can explain it when asked.

Cheers,
-Chris
Checking the perl, it seems that errors are the reason for negative values, no?

Code: Select all

   $elapsed[$i]= -2000;                 # query returned error
   $elapsed[$i]= -3000;                 # did not resolve into an A record
   $elapsed[$i]= -1000;                  # timeout occurred
I'll keep reading...

-Chris
gnydick
Posts: 8
Joined: Mon Oct 02, 2006 10:45 am
Location: NJ
Contact:

What about poller timing?

Post by gnydick »

When the poller runs, it sits and waits for this script to finish, which takes 5 minutes, so the first time your run it, won't some of your SNMP stats be 10 minutes old because they'll run after the perl script? Or does cacti always run scripts last? What if there are multiple scripts, how can you assure that this one, that takes 5 minutes will be last, otherwise it'll impact the other probes.
gabar
Posts: 27
Joined: Mon Jun 13, 2005 3:53 am
Location: Rome
Contact:

Negative values? What does it means?

Post by gabar »

Delta wrote:I have discovered the problem. The script name was dnsResponseTime.pl so cacti could not find it. I have rename it in dnsResponseTimeLoop.pl and now is drawing something on the graphs but I don't know if those are the true values. The graph shows on all values number -2.00 K and does not move from this point.:cry:

"Description:
Place as dnsResponseTime.pl into /home/cactiuser and make sure it has the correct chown, chgrp and access rights. " This was the problem :wink:
I have the same problem: I saw all values of -2.00 K. Can you tell me in which way you solved the problem? Thank you very much!

Gabriele
savage
Posts: 1
Joined: Mon Oct 30, 2006 9:16 pm

Re: DNS Server Response Time: Script & Templates

Post by savage »

This script uses module "Net::DNS" to get the DNS ResponseTime.but "Net::DNS" is slow.so sometimes it returns the negative time.
I suggest use dig command to get the Qurey Response time.
when using dig command,it return the "Query time".this value can used as "ResponseTime".we can use "dig" 10 times to get 10 different values.then get the min,max and the average value as the min,max and the average DNS ResponseTime.

Anyone can write a sample perl script ?
gagadget
Cacti User
Posts: 71
Joined: Tue Feb 21, 2006 9:40 am

Post by gagadget »

What does exactly mean the "Total query time" ouput of dig.
Does it take the network time with ?
Is dig use the local resolver cache ?
I have only seen "msec" measure from dig, does it switch to "sec" when time is > 999 msec ?

Tomorrow, I am going to have a look at the dig source and try to write a quick and dirty script.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests