Bind 9: Queries and Zone Statistics

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

Moderators: Developers, Moderators

Leddy
Cacti User
Posts: 93
Joined: Sun May 15, 2005 6:55 pm

Bind 9: Queries and Zone Statistics

Post by Leddy »

I will post templates as soon as I get the graphs converted, until then....

You may need to modify the script defaults they assume named.stats is /var/named/named.stats and query.log is /var/named/query.log. You will also need to modify your named.conf to reflect the following changes

logging {
channel query_logging {
file "/var/named/query.log";
print-category yes;
print-severity yes;
print-time yes;
};

category queries {
query_logging;
};

unix_named_statistics.php has no arguments
unix_named_zone_statistics.php will take no arguments or domain name as configured in named.conf i.e. cacti.net If no arguments are specified it will display statistics of cache "." zone.
Attachments
graph_78_1.png
graph_78_1.png (51.81 KiB) Viewed 37283 times
graph_79_1.png
graph_79_1.png (45.85 KiB) Viewed 37283 times
Last edited by Leddy on Tue May 24, 2005 3:57 pm, edited 2 times in total.
Leddy
Cacti User
Posts: 93
Joined: Sun May 15, 2005 6:55 pm

Post by Leddy »

Here are the scripts
Attachments
unix_named_statistics.php.txt
(1.28 KiB) Downloaded 2255 times
unix_dns_queries.php.txt
(1.26 KiB) Downloaded 2912 times
Last edited by Leddy on Tue May 24, 2005 9:09 am, edited 1 time in total.
Leddy
Cacti User
Posts: 93
Joined: Sun May 15, 2005 6:55 pm

Post by Leddy »

DNS Queries Template
Attachments
cacti_data_template_unix_dns_queries.xml
(11.42 KiB) Downloaded 1660 times
cacti_graph_template_unix_dns_queries.xml
(39.34 KiB) Downloaded 2130 times
Leddy
Cacti User
Posts: 93
Joined: Sun May 15, 2005 6:55 pm

Post by Leddy »

Reserved for Zone Statistics Templates
piccilli
Posts: 8
Joined: Tue May 24, 2005 2:08 pm
Contact:

Post by piccilli »

I am using bind 9.3.1 and dont exist category statistics.

In logs i receive this:
named.conf.local:27: unknown logging category 'statistics' ignored

BIND 9 Configuration Reference show this categories:
default, general, database, security, config, resolver, xfer-in, xfer-out, notify, client, unmatched, network, update, update-security, queries, dispatch, dnssec, lame-servers and delegation-only.

Nothing about statistics.

Any help ?
Leddy
Cacti User
Posts: 93
Joined: Sun May 15, 2005 6:55 pm

Post by Leddy »

You are absolutely correct. It looks like "statistics" is deprecated as of bind 9. It is not needed as we are only concerned with queries. I'll modify original post to reflect that.
piccilli wrote:I am using bind 9.3.1 and dont exist category statistics.

In logs i receive this:
named.conf.local:27: unknown logging category 'statistics' ignored

BIND 9 Configuration Reference show this categories:
default, general, database, security, config, resolver, xfer-in, xfer-out, notify, client, unmatched, network, update, update-security, queries, dispatch, dnssec, lame-servers and delegation-only.

Nothing about statistics.

Any help ?
aleto
Posts: 39
Joined: Wed May 25, 2005 3:57 am

Post by aleto »

Hi!

Does anyone have any information or HOWTO's on howto implement this over SNMP ?

Thnx in advance!
pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Post by pbulteel »

I think you might be able to do it over SNMP if you use the exec part of the snmpd.conf

Here's the comments in mine

Code: Select all

###############################################################################
# Extensible sections.
#

# This alleviates the multiple line output problem found in the
# previous executable mib by placing each mib in its own mib table:

# Run a shell script containing:
#
# #!/bin/sh
# echo hello world
# echo hi there
# exit 35
#
# Note:  this has been specifically commented out to prevent
# accidental security holes due to someone else on your system writing
# a /tmp/shtest before you do.  Uncomment to use it.
#
# exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest

# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.50
# enterprises.ucdavis.50.1.1 = 1
# enterprises.ucdavis.50.2.1 = "shelltest"
# enterprises.ucdavis.50.3.1 = "/bin/sh /tmp/shtest"
# enterprises.ucdavis.50.100.1 = 35
# enterprises.ucdavis.50.101.1 = "hello world."
# enterprises.ucdavis.50.101.2 = "hi there."
# enterprises.ucdavis.50.102.1 = 0

# Now the Output has grown to two lines, and we can see the 'hi
# there.' output as the second line from our shell script.
#
# Note that you must alter the mib.txt file to be correct if you want
# the .50.* outputs above to change to reasonable text descriptions.

# Other ideas:
#
# exec .1.3.6.1.4.1.2021.51 ps /bin/ps
# exec .1.3.6.1.4.1.2021.52 top /usr/local/bin/top
# exec .1.3.6.1.4.1.2021.53 mailq /usr/bin/mailq
So probably you could use

exec .1.3.6.1.4.1.2021.51 DNSQuery /path/to/file.php

This might have to be done as a shell script which just contains

Code: Select all

#!/bin/sh
/path/to/phpcommandline /path/to/file.php
so that it can execute it instead.

Please note I haven't tested it yet!!! But I'll gladly help out anyone that does.


-P
uname -a
irfandp
Posts: 11
Joined: Mon Jun 27, 2005 7:26 am
Contact:

unlike mailgraph.pl for postfix log grapher

Post by irfandp »

i assume this php script is counting the output of query log ..entirely..

we need to rotate that log file every minute to gain fast log check and fast snmp trapping with this script (with my query log for 5 minutes containing 35MBytes of file).

mailgraph.pl script is counting log check and pass it to another file continously with daemon mode. So that other file can be read real time with other script that snmpd.conf put into.

It would be great if there is a new update about the script for query zone statistics with this kind of query logging
Linuxfreak_be
Posts: 22
Joined: Sun Sep 04, 2005 3:30 am
Location: Belgium

Post by Linuxfreak_be »

hi people,

i'm using this and i have a little problem.The graph is created but it stays blank.I have successfully configurerd bind for the logging thing and if i run the script from the command line i get a correct result my question is why on earth does that graph stays blank ? my log shows several dns queries :-?
Attachments
dns_queries.png
dns_queries.png (9.89 KiB) Viewed 35768 times
Leddy
Cacti User
Posts: 93
Joined: Sun May 15, 2005 6:55 pm

Post by Leddy »

i'm using this and i have a little problem.The graph is created but it stays blank.I have successfully configurerd bind for the logging thing and if i run the script from the command line i get a correct result my question is why on earth does that graph stays blank ? my log shows several dns queries
Few things to try. Turn on debug level in cacti and see if you are getting a result or "U". Make sure the user running the poller.ph has permissions to read the query.log. Chances are you are testing with "root" and running cmd.php with "cactiuser".

Those would be the 2 most common reasons
Linuxfreak_be
Posts: 22
Joined: Sun Sep 04, 2005 3:30 am
Location: Belgium

Post by Linuxfreak_be »

Leddy wrote:
i'm using this and i have a little problem.The graph is created but it stays blank.I have successfully configurerd bind for the logging thing and if i run the script from the command line i get a correct result my question is why on earth does that graph stays blank ? my log shows several dns queries
Few things to try. Turn on debug level in cacti and see if you are getting a result or "U". Make sure the user running the poller.ph has permissions to read the query.log. Chances are you are testing with "root" and running cmd.php with "cactiuser".

Those would be the 2 most common reasons
yes tat's true on my shell i run it with root and the poller is running under th cacti user now how to change that
Linuxfreak_be
Posts: 22
Joined: Sun Sep 04, 2005 3:30 am
Location: Belgium

Post by Linuxfreak_be »

hi,

That was true and the permissions issues have been relsolved seems like my directorypermissions and the permissions on *.php files where not setup correctly it looks like working now

peace :wink:
Attachments
dns_queries_fixed.png
dns_queries_fixed.png (11.63 KiB) Viewed 35404 times
akashah
Posts: 29
Joined: Mon May 29, 2006 10:36 pm
Location: Malaysia

Post by akashah »

Hi guys,

I get this error when i try to get the graph.
07/24/2006 11:50:03 PM - CMDPHP: Poller[0] Host[2] DS[3] WARNING: Result from CMD not valid. Partial Result:

i run the cmd.php manually. And i get this error.
sh: /var/www/localhost/htdocs/cacti/scripts/unix_dns_queries.php: /usr/bin/php^M: bad interpreter: No such file or directory

How i can fix this problem? Any help is appreciated.
akashah
Posts: 29
Joined: Mon May 29, 2006 10:36 pm
Location: Malaysia

Post by akashah »

any suggestion? :(
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests