snmp query problem

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
Linuxfreak_be
Posts: 22
Joined: Sun Sep 04, 2005 3:30 am
Location: Belgium

snmp query problem

Post by Linuxfreak_be »

hi people,

Just installed this cacti thing found it while surfing around at freshmeat.net

installation went fine but i'm tying to use a dns addon from here that's querry statistics over nsmp and cacti always tells me
This data query returned 0 rows, perhaps there was a problem executing this data query. You can run this data query in debug mode to get more information.
if i click the link "debug mode" i get this
+ Running data query [13].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/cacti/resource/snmp_queries/bind9-stats-snmp.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2021.55.1'
+ No SNMP data returned
+ Found data query XML file at '/cacti/resource/snmp_queries/bind9-stats-snmp.xml'
+ Found data query XML file at '/cacti/resource/snmp_queries/bind9-stats-snmp.xml'
+ Found data query XML file at '/cacti/resource/snmp_queries/bind9-stats-snmp.xml'
sensitive serverpaths have been removed above ..

how do i get that working correctly ...

possible cause found

i see my bind 9 has a "statistics-file" statement but the file is never never writen to the given path so i'm thinking about a permissions problem here but i'm not totally sure and scared i mess thing up schouldn't the "named" user have write permissions to write the stats dump file :?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: snmp query problem

Post by gandalf »

Linuxfreak_be wrote:i see my bind 9 has a "statistics-file" statement but the file is never never writen to the given path so i'm thinking about a permissions problem here but i'm not totally sure and scared i mess thing up schouldn't the "named" user have write permissions to write the stats dump file :?
Linuxfreak_be,
you've found it! :wink: Try to "touch <named_stats file>" under your named userid. Pay attention to directory permissions. If at least the file is created, try that command you have to put into your named servers cron. Have a look at <named_stats file>. If that works, try cacti again (assuming the snmp stuff is done).
[my opinion]As we are using several net-snmp triggered queries like this for named or some others for mail scanning and delivery, we introduced some numeric space under ucdavis .1.3.6.1.4.1.2021, in our case .1.3.6.1.4.1.2021.999. All our own stuff goes there, e.g. .1.3.6.1.4.1.2021.999.1 contains all named stuff, .1.3.6.1.4.1.2021.999.2 some mail stuff, .1.3.6.1.4.1.2021.999.3 the next one and so on.[/my opinion] :P
Reinhard
Linuxfreak_be
Posts: 22
Joined: Sun Sep 04, 2005 3:30 am
Location: Belgium

Post by Linuxfreak_be »

yeah well,

that snmp query return no errors any longer and the graph is created but it looks like it stays blank which is impossible as my server is the master dns server
  • touch /var/named/data/named_stats.txt
  • chown named:named /var/named/data
  • chmod 700 /var/named/data
will wait a while ...
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Linuxfreak_be wrote:touch /var/named/data/named_stats.txt
What about using that cron line. Must be something like "rndc stats" or "ndc stats" or so? Did you check that very thingy? Then, please have a look at your /var/named/data/named_stats.txt. It should not be empty any more. And you do not have to wait...

Reinhard
Linuxfreak_be
Posts: 22
Joined: Sun Sep 04, 2005 3:30 am
Location: Belgium

Post by Linuxfreak_be »

lvm wrote:
Linuxfreak_be wrote:touch /var/named/data/named_stats.txt
What about using that cron line. Must be something like "rndc stats" or "ndc stats" or so? Did you check that very thingy? Then, please have a look at your /var/named/data/named_stats.txt. It should not be empty any more. And you do not have to wait...

Reinhard
well the intructions tell you to include
pass .1.3.6.1.4.1.2021.55 /usr/bin/perl /usr/local/bin/bind9-stats-snmpd.pl
in /etc/snmpd/snmpd.conf

i did that + i corrected the path to the stats in the perl script but nope strange strange i'm using this addon


i don't get it that instructions include a script you need to run via cron

Code: Select all

#!/bin/bash

#
# Script to generate bind9 stats file to be run from cron
#
# Created By: Cory Powers <cory@uversaconsulting.net>
#


#############
# CONFIGURATION - Begin
#
# named.stats file location, this should match the
# file name and path for the statistics-file directive
# in your named.conf file
STAT_FILE=/var/named/data/named.stats

# Location of rndc executable
RNDC=/usr/sbin/rndc

# CONFIGURATION - End
#############

rm $STAT_FILE #why delete stat file ?
$RNDC stats
RNDC_RET=$?
if [ $RNDC_RET -ne 0 ]; then
	echo "Error running $RNDC:$RNDC_RET"
	exit $RNDC_RET
else
	exit 0
fi
why on earth is that script deleting my stats file ?
Linuxfreak_be
Posts: 22
Joined: Sun Sep 04, 2005 3:30 am
Location: Belgium

Post by Linuxfreak_be »

i totally don't get it look what i found
Sep 4 21:49:52 server1 named[634]: shutting down: flushing changes
Sep 4 21:49:52 server1 named[634]: shutting down: flushing changes
Sep 4 21:49:52 server1 named[634]: stopping command channel on 127.0.0.1#953
Sep 4 21:49:52 server1 named[634]: stopping command channel on 127.0.0.1#953
Sep 4 21:49:52 server1 named[634]: no longer listening on 64.34.166.84#53
Sep 4 21:49:52 server1 named[634]: no longer listening on 64.34.166.84#53
Sep 4 21:49:52 server1 named[634]: exiting
Sep 4 21:49:52 server1 named[634]: exiting
Sep 4 21:49:53 server1 named[7528]: starting BIND 9.3.1 -u named -t /var/named/chroot
Sep 4 21:49:53 server1 named[7528]: starting BIND 9.3.1 -u named -t /var/named/chroot
Sep 4 21:49:53 server1 named[7528]: found 1 CPU, using 1 worker thread
Sep 4 21:49:53 server1 named[7528]: found 1 CPU, using 1 worker thread
Sep 4 21:49:53 server1 named[7528]: loading configuration from '/etc/named.conf'
Sep 4 21:49:53 server1 named[7528]: loading configuration from '/etc/named.conf'
Sep 4 21:49:53 server1 named[7528]: listening on IPv4 interface eth0, 64.34.166.84#53
Sep 4 21:49:53 server1 named[7528]: listening on IPv4 interface eth0, 64.34.166.84#53
Sep 4 21:49:53 server1 named[7528]: command channel listening on 127.0.0.1#953
Sep 4 21:49:53 server1 named[7528]: command channel listening on 127.0.0.1#953
Sep 4 21:49:53 server1 named[7528]: logging channel 'query_logging' file '/var/log/query.log': file not found
Sep 4 21:49:53 server1 named[7528]: logging channel 'query_logging' file '/var/log/query.log': file not found
Sep 4 21:49:53 server1 named[7528]: zone delphiprogramming.be/IN: loaded serial 2005090300
Sep 4 21:49:53 server1 named[7528]: zone delphiprogramming.be/IN: loaded serial 2005090300
Sep 4 21:49:53 server1 named[7528]: zone localhost/IN: loaded serial 42
Sep 4 21:49:53 server1 named[7528]: zone localhost/IN: loaded serial 42
Sep 4 21:49:53 server1 named[7528]: running
Sep 4 21:49:53 server1 named[7528]: running
Sep 4 21:49:53 server1 named[7528]: zone delphiprogramming.be/IN: sending notifies (serial 2005090300)
Sep 4 21:49:53 server1 named[7528]: zone delphiprogramming.be/IN: sending notifies (serial 2005090300)
Sep 4 21:49:55 server1 named[7528]: isc_log_open '/var/log/query.log' failed: file not found
Sep 4 21:49:55 server1 named[7528]: isc_log_open '/var/log/query.log' failed: file not found
the file query.log is in /var/log/ but still it says file not found :-? :-? :-? :-?

cpanel /whm bug ??????
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Linuxfreak_be wrote:pass .1.3.6.1.4.1.2021.55 /usr/bin/perl /usr/local/bin/bind9-stats-snmpd.pl
This is for parsing the output produced by rndc and put into STAT_FILE=/var/named/data/named.stats This part seems to be ok.

Code: Select all

...
# Script to generate bind9 stats file to be run from cron
This one has to be put into cron of the remote named machine as is stated by the comments. It deletes the stats file on each cron run and re-generates it by using rndc. So this file only contains the output of the last rndc run.
And here's the trick: The cron job must run on the remote machine and has to complete before cacti queries the output using snmp. The chance, that cacti drops right in between deleting and re-generating is little, but depends on the runtime of the rndc. If clocks are not synchronized, there may be a chance, that cacti reads the output from the "old" rndc.

hth
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest