I set up, sometimes ago, a Cacti plugin on a Linux Debian that allows to collect DNS statistics, through SNMP/rndc queries, for generating beautiful graphics.
It was working fine until some weeks ago... :-(
So the issue is that the file named.stats has its specific user/group file permissions as usual. But the Cacti poller user hasn't the needed file permission to read it...
The work-flow is:
- the Cacti poller calls the
- this script does a
snmpgetof the hostname
runstats.shperforms the following:
- deletes the old named.stats
- does a
rndc statsthat generates a new named.stats file.
- reads & parses the named.stats file with a Perl template
mdw05:~# /usr/share/cacti/site/scripts/bind-stats.sh example.serverfault.com snmpCommunity cat: /var/cache/bind/named.stats: Permission denied mdw05:~# mdw05:~# ls -l /var/cache/bind/named.stats -rw-r----- 1 bind bind 4.8K Jul 23 10:54 /var/cache/bind/named.stats mdw05:~#
Therefore, how can I configure Bind
rndccommand to change the default file permissions to allow the script
runstats.sh to read this file...?
I have already tried to add SNMP and/or Cacti user as member of the Bind group, but it doesn't work >_<
Thanks for your help.
#!/bin/sh # $1 hostname $2 community /usr/bin/snmpget -v 2c -Ovq -c $2 $1 .184.108.40.206.4.1.186220.127.116.11.18.104.22.168.22.214.171.124.126.96.36.199.188.8.131.52.115.1 | sed 's/"//g'
## cacti polling (http://docs.cacti.net/usertemplate:host:bind9.7) extend .184.108.40.206.4.1.18689.0.1 dnscache-stats /usr/local/sbin/cacti_bind9.7/runstats.sh
#!/bin/sh rm -f /var/cache/bind/named.stats rndc stats cat /var/cache/bind/named.stats | perl /usr/local/sbin/cacti_bind9.7/dnsstats.pl