When you google for a cacti template for DNS response time, there’s not a whole lot out there, and what is; is pretty out dated or involves too much fidgetry.
This guide shows you how to slap together a quick DNS response data input method that will allow you to setup graphs on a nameserver/domain pair granularity. (Meaning, you can graph the same domain across several NS’s, or vice versa).
So here’s a quick rundown on creating a “data input method” and a “data template” for cacti to utilize for your nameservers.
1. Create a new data input method
Name: (anything you want)
Input type: Script/Command
echo "ResponseTime:"`dig @<ns> <dom>|grep ";; Query time:" |cut -n -d " " -f 4`
The 1-liner above should get you the msec for given domain (dom) at given nameserver (ns). To test completely, replace the dom and ns lines with something valid:
echo "ResponseTime:"`dig @220.127.116.11 www.ebay.com | \<br />grep ";; Query time:" | \<br />cut -n -d " " -f 4`<br />
1b. Add the two ‘input fields’, ns and dom.
1c. Add “ResponseTime” as an ‘output field’.
If done correctly, it should look similar to this:
2. Create the data template – Fill out the values to look similar to the screenshot below. Note, you will probably have to hit ‘create’ after selecting the data input method under “data source”. This will detect the “output field” for the “Data Source Item” values.
Here’s what one of mine looks like:
I’ve omitted the target host/ns from this example image of course :)