BIND 9.7 (only) host template

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

Moderators: Moderators, Developers

Author
Message
fonts
Posts: 22
Joined: Tue Jan 08, 2008 8:19 pm

Re: BIND 9.7 host template

#31 Post by fonts » Tue Oct 16, 2012 6:48 am

timi wrote:looks like some of the variables are not readed from the stats file, run the script manualy and see if any errors
no errors. :-?

Code: Select all

 
a:2554 a6:0 aaaa:204 any:0 cname:0 mx:0 naptr:0 ns:432 ptr:10 soa:0 spf:0 srv:73 txt:0 rsnx:3 rsfail:20 rserr: rsipv4qs:1921 rsipv4rr:1811 rsmismatch: rsqr:121 rsqt:110 rsrtt10: rsrtt100500:348 rsrtt10100:1454 rsrtt1600: rsrtt500800:6 rsrtt8001600:3 sockopen:1923 sockclosed:1921 sockbf: consest:1921 recverr

User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Re: BIND 9.7 host template

#32 Post by timi » Tue Oct 16, 2012 7:02 am

you are missing some vars as I can see from your output, you need to verify why are these vars not gathering, without them the it wont work

fonts
Posts: 22
Joined: Tue Jan 08, 2008 8:19 pm

Re: BIND 9.7 (only) host template

#33 Post by fonts » Wed Oct 17, 2012 7:53 am

if i run the script manually it works fine.

User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Re: BIND 9.7 (only) host template

#34 Post by timi » Wed Oct 17, 2012 8:02 am

please post the output of <path_cacti>/scripts/bind-stats.sh <hostname>

pnyet
Posts: 4
Joined: Tue Dec 04, 2012 3:58 am

Re: BIND 9.7 (only) host template

#35 Post by pnyet » Tue Dec 04, 2012 4:19 am

Hi Timi,

Thanks for the scripts, but I've a problem with graph won't appear. Please see below for script and log results:

This command is running from cacti host.

# snmpwalk -v 2c -Ovq -c dns123 10.0.0.10 .1.3.6.1.4.1.18689.0.1
1
"/usr/sbin/runstats.sh"
""
""
5
1
1
4
1
"a:1556462 a6:307 aaaa:354564 any:231 cname:96 mx:120134 naptr:21 ns:9395 ptr:161701 soa:3011 spf:5840 srv:10347 txt:30663 rsnx:67027 rsfail:12121 rserr:7874 rsipv4qs:860637 rsipv4rr:763222 rsmismatch:21 rsqr:155825 rsqt:107333 rsrtt10:63375 rsrtt100500:582898 rsrtt10100:202075 rsrtt1600:38 rsrtt500800:1994 rsrtt8001600:130 sockopen:910396 sockclosed:910341 sockbf:990 consest:909404 recverr:1682"
"a:1556462 a6:307 aaaa:354564 any:231 cname:96 mx:120134 naptr:21 ns:9395 ptr:161701 soa:3011 spf:5840 srv:10347 txt:30663 rsnx:67027 rsfail:12121 rserr:7874 rsipv4qs:860637 rsipv4rr:763222 rsmismatch:21 rsqr:155825 rsqt:107333 rsrtt10:63375 rsrtt100500:582898 rsrtt10100:202075 rsrtt1600:38 rsrtt500800:1994 rsrtt8001600:130 sockopen:910396 sockclosed:910341 sockbf:990 consest:909404 recverr:1682"
1
0
"a:1556462 a6:307 aaaa:354564 any:231 cname:96 mx:120134 naptr:21 ns:9395 ptr:161701 soa:3011 spf:5840 srv:10347 txt:30663 rsnx:67027 rsfail:12121 rserr:7874 rsipv4qs:860637 rsipv4rr:763222 rsmismatch:21 rsqr:155825 rsqt:107333 rsrtt10:63375 rsrtt100500:582898 rsrtt10100:202075 rsrtt1600:38 rsrtt500800:1994 rsrtt8001600:130 sockopen:910396 sockclosed:910341 sockbf:990 consest:909404 recverr:1682"


[[email protected] ~]# snmpwalk -v 2c -Ovq -c dns123 10.0.0.10 .1.3.6.1.4.1.18689.0.1.4.1.2.14.100.110.115.99.97.99.104.101.45.115.116.97.116.115
"a:1570579 a6:311 aaaa:357984 any:233 cname:96 mx:121133 naptr:21 ns:9530 ptr:163269 soa:3029 spf:5912 srv:10394 txt:30935 rsnx:67785 rsfail:12229 rserr:7925 rsipv4qs:868479 rsipv4rr:770215 rsmismatch:21 rsqr:157142 rsqt:108253 rsrtt10:63937 rsrtt100500:588243 rsrtt10100:203888 rsrtt1600:38 rsrtt500800:2020 rsrtt8001600:138 sockopen:918789 sockclosed:918715 sockbf:1001 consest:917786 recverr:1691"

Below is log from cacti

12/02/2012 06:24:05 PM - SPINE: Poller[0] Host[390] ERROR: Empty result [10.0.0.10]: '/home/nginxuser/scripts/bind-stats.sh 10.0.0.10'
12/02/2012 06:25:05 PM - SPINE: Poller[0] Host[390] ERROR: Empty result [10.0.0.10]: '/home/nginxuser/scripts/bind-stats.sh 10.0.0.10'
12/02/2012 06:25:05 PM - SPINE: Poller[0] Host[390] ERROR: Empty result [10.0.0.10]: '/home/nginxuser/scripts/bind-stats.sh 10.0.0.10'
12/02/2012 06:25:05 PM - SPINE: Poller[0] Host[390] ERROR: Empty result [10.0.0.10]: '/home/nginxuser/scripts/bind-stats.sh 10.0.0.10'
12/02/2012 06:25:05 PM - SPINE: Poller[0] Host[390] ERROR: Empty result [10.0.0.10]: '/home/nginxuser/scripts/bind-stats.sh 10.0.0.10'


# sudo -u nginxuser sh /home/nginxuser/scripts/bind-stats.sh 10.0.0.10
a:2221613 a6:429 aaaa:515396 any:379 cname:140 mx:171062 naptr:30 ns:15156 ptr:239552 soa:4218 spf:9158 srv:14500 txt:45280 rsnx:96278 rsfail:18434 rserr:11312 rsipv4qs:1233254 rsipv4rr:1097893 rsmismatch:34 rsqr:220077 rsqt:149640 rsrtt10:90148 rsrtt100500:842735 rsrtt10100:290112 rsrtt1600:47 rsrtt500800:3029 rsrtt8001600:270 sockopen:1305758 sockclosed:1305695 sockbf:1431 consest:1304325 recverr:2306

For additional info, my cacti running on PHP 5.3.15 and MySQL 5.1.63, Nginx and Cacti 0.8.8a. If any further information required please just ask me :D

Thanks n regards,
pnyet

pnyet
Posts: 4
Joined: Tue Dec 04, 2012 3:58 am

Re: BIND 9.7 (only) host template

#36 Post by pnyet » Tue Dec 04, 2012 6:00 am

Hi,

Please ignore my previous post, the problem has been solved after change permission on bind-stats.sh to 755.

Thanks

ubik
Posts: 6
Joined: Fri Oct 30, 2009 4:41 am

Re: BIND 9.7 (only) host template

#37 Post by ubik » Fri Dec 14, 2012 5:51 am

After a bit of struggle getting this great script to work, id like to share my solution.

I read in the other post, that the solution was to run snmpd as root.
This is maybe not the best solution for a producion server, because of security issues.
I use sudo and the sudoers file.

in the sudoers file i added the following two lines. EDIT the sudoers file only with visudo command,
otherwise the changes arent made.

Code: Select all

snmp    ALL = NOPASSWD: /root/scripts/dnsstats.pl
snmp    ALL = NOPASSWD: /root/scripts/runstats.sh
I put the scripts in root/scripts instead of root/bin. Change the path as you need.
Here you see, that i allow the user snmp to use sudo on this certain script without password.

In the /etc/snmpd.conf i changed the line to.

Code: Select all

extend .1.3.6.1.4.1.18689.0.1 dnscache-stats /usr/bin/sudo /root/scripts/runstats.sh
Again edit the line to match the path where you put your shellscript and restart snmpd afterwards.

And now the cacti server can access the script via the snmp user, without using a password.


greez ubik
Last edited by ubik on Fri Dec 14, 2012 6:24 am, edited 2 times in total.

User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Re: BIND 9.7 (only) host template

#38 Post by timi » Fri Dec 14, 2012 5:56 am

great

jmaris83
Posts: 3
Joined: Sun Apr 14, 2013 4:53 am

Re: BIND 9.7 (only) host template

#39 Post by jmaris83 » Sun Apr 14, 2013 5:20 am

Hello,

I am trying to setup this template on my cacti installation (version 0.8.7.g) and I have a problem with "nan" values in every field of my graphs.
The template is setup for two name servers running bind 9.7.3 and I get no results for any of them.

I am not an expert so I tried to debug the problem as much as I can and concluded the following:

In cacti log I get the following error (for all related graphs), after running one cycle in debug mode:
04/14/2013 01:00:02 PM - CMDPHP: Poller[0] Host[1] DS[166] CMD: <path_cacti>/scripts/bind-stats.sh <hostname>, output: U
04/14/2013 01:00:02 PM - CMDPHP: Poller[0] Host[1] DS[166] WARNING: Result from CMD not valid. Partial Result: U

I am able to run <path_cacti>/scripts/bind-stats.sh <hostname> from console for both hosts and get answer in the right format.

I think my problem is caused by this:

I noticed that the output of named stats doesn't provide all the info every time.
Meaning some fields, ie rsrtt500800, doesn't show in the output at all in some cycles but in other cycles it shows and returns a value.
So when bind-stats.sh is reading the file, for these fields it gives no result for the variables, resulting in an output like this with partial results:

a:12685 a6:0 aaaa:177 any:80 cname:0 mx:1879 naptr:0 ns:3 ptr:175 soa:21 spf:2 srv:7 txt:47 rsnx: rsfail: rserr: rsipv4qs:644 rsipv4rr:570 rsmismatch: rsqr:84 rsqt:74 rsrtt10: rsrtt100500:10 rsrtt10100:560 rsrtt1600: rsrtt500800: rsrtt8001600: sockopen:648 sockclosed:646 sockbf: consest:644 recverr:

Is this really my problem and if so how can I overcome this?
Is there any way for bind-stats.sh script to return "0" value for every cycle that these fields are not provided in named stats output?

Thank you in advance for any help. :D
Last edited by jmaris83 on Sun Apr 14, 2013 10:55 am, edited 1 time in total.

jmaris83
Posts: 3
Joined: Sun Apr 14, 2013 4:53 am

Re: BIND 9.7 (only) host template

#40 Post by jmaris83 » Sun Apr 14, 2013 10:47 am

Update on my problem.

I tried the following and checked if it helps.

I edited the dnsstats.pl file and tried to result a value for all variables that weren't calculated.
I added for each variable the value extracted from the file plus "0", resulting in an output of "0" for all vars that weren't calculated.
i.e. $recverr=$recverr+0;
I ain't familiared with perl, so I don't even know if what I did is correct but my output now gives values to all vars:

#./bind-stats.sh <hostname>
a:29073 a6:2 aaaa:379 any:97 cname:6 mx:2629 naptr:0 ns:12 ptr:992 soa:6 spf:5 srv:3 txt:181 rsnx:204 rsfail:0 rserr:0 rsipv4qs:10558 rsipv4rr:10506 rsmismatch:0 rsqr:52 rsqt:52 rsrtt10:0 rsrtt100500:484 rsrtt10100:9997 rsrtt1600:0 rsrtt500800:20 rsrtt8001600:5 sockopen:10576 sockclosed:10573 sockbf:0 consest:10558 recverr:0

However, I still get NAN values to my graphs.

I am afraid I' m running out of ideas... :(

jmaris83
Posts: 3
Joined: Sun Apr 14, 2013 4:53 am

Re: BIND 9.7 (only) host template

#41 Post by jmaris83 » Mon Apr 15, 2013 3:55 am

I finally managed to get values and start graph plotting.

I followed gandalf's debug guide from the start and it turned out that it was a permission issue on the script by cacti user.

I now get no errors in my log and graphs are plotting.

However, the values seem to be wrong and most of them show "0" in gprints even though in the graphs they have a value >0.

I 'm still working on that, so just ignore my previous posts.

Cheers.

User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Re: BIND 9.7 (only) host template

#42 Post by timi » Mon Apr 15, 2013 4:17 am

glad you mange to solve the problem, anyway if there is less than 1q/s then the graphs will show 0 so make sure you have at least 1-2q/s :)

vpanos
Posts: 4
Joined: Fri Nov 05, 2010 12:24 am

Re: BIND 9.7 (only) host template

#43 Post by vpanos » Mon May 20, 2013 1:52 am

I started using the template but everytime the server is restarting I get a huge spike in all the graphs. I tried using spike killer plugin but it didn't work.
Is there any other way to prevent these spikes?

Image

User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Re: BIND 9.7 (only) host template

#44 Post by timi » Mon May 20, 2013 4:41 am

if you define all $vars as 0 in the perl script I think the spikes should not appear

vpanos
Posts: 4
Joined: Fri Nov 05, 2010 12:24 am

Re: BIND 9.7 (only) host template

#45 Post by vpanos » Mon May 20, 2013 6:18 am

timi wrote:if you define all $vars as 0 in the perl script I think the spikes should not appear
Thank you for your reply, I tried your advice but it didn't work. I don't know perl very well so there is a chance I did it wrong.
Anyway, spike killer finally worked and cleared the graphs, I just needed to apply it many times in every graph.

Post Reply