DNS Server Response Time: Script & Templates

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

Moderators: Moderators, Developers

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

DNS Server Response Time: Script & Templates

#1 Post by rsommerhalder » Mon Feb 07, 2005 9:03 am

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 77988 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 10384 times
cacti_graph_template_dnsresponsetime.xml
Import into Cacti through Web interface, will create the templates.
(20.12 KiB) Downloaded 9656 times

xpyros01
Posts: 2
Joined: Thu May 19, 2005 9:48 am

Re: DNS Server Response Time: Script & Templates

#2 Post by xpyros01 » Thu May 19, 2005 9:50 am

Hi,

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

Regards.

aboyz

hi.

#3 Post by aboyz » Thu May 19, 2005 2:20 pm

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.

#4 Post by laffen » Mon May 23, 2005 7:30 am

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:

#5 Post by Delta » Thu Aug 25, 2005 1:15 pm

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

#6 Post by xpyros01 » Sat Aug 27, 2005 6:48 am

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:

#7 Post by Delta » Sat Aug 27, 2005 7:31 am

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:

#8 Post by Delta » Sun Aug 28, 2005 9:59 am

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

#9 Post by Linuxfreak_be » Thu Sep 08, 2005 10:04 am

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

#10 Post by wan-geek » Thu Sep 22, 2005 4:30 pm

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

#11 Post by wan-geek » Fri Sep 23, 2005 4:54 pm

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?

#12 Post by gnydick » Mon Oct 02, 2006 10:46 am

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: 21
Joined: Mon Jun 13, 2005 3:53 am
Location: Rome
Contact:

Negative values? What does it means?

#13 Post by gabar » Sat Oct 14, 2006 7:14 am

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

#14 Post by savage » Thu Nov 02, 2006 3:53 am

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: 68
Joined: Tue Feb 21, 2006 9:40 am

#15 Post by gagadget » Thu Nov 02, 2006 10:51 am

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