PowerDNS Recursor Templates [updated 29/7/09]

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

Moderators: Developers, Moderators

vlahti
Posts: 3
Joined: Wed Jul 25, 2012 3:34 am

Re: PowerDNS Recursor Templates [updated 29/7/09]

Post by vlahti »

Hello,
raymonvdm wrote:root@machine:/home/me# snmpwalk -v2c -ctest 127.0.0.1 .1.3.6.1.4.1.8072.1.3.2.4.1.2
NET-SNMP-EXTEND-MIB::nsExtendOutLine."pdns-rec".1 = STRING: Fatal: Unable to generate local temporary file in directory '/var/run/': Permission denied
When i change the snmp service to run as root the problem is resolved, but i would like to run snmp as snmp user
Wondering around this problem also. Do you have solution?
running as a root it works, but when suing snmp user, then I get error message.

# snmpwalk -On -v2c -c [community] [ip-addr] 1.3.6.1.4.1.8072.1.3.2.4.1.2
.1.3.6.1.4.1.8072.1.3.2.4.1.2.8.112.100.110.115.45.114.101.99.1 = STRING: "Fatal: Unable to generate local temporary file in directory '/var/run/': Permission denied"

cacti version 0.8.7e
pdns version 3.2
debian 6.x on cacti and dns server

//vlahti
KeeF
Posts: 1
Joined: Thu Nov 22, 2012 3:05 am

Re: PowerDNS Recursor Templates [updated 29/7/09]

Post by KeeF »

hi,

My solution for this problem:

- change the socketdir to: /var/run/powerdns
- give right to snmp for writing to this directory, and files
- modified the scripts to call directly binaries, pdns_control and rec_control
- test it

sadly, when reboot/restart services you must change rights on the sockets.
anuragbhatia
Posts: 3
Joined: Thu Dec 05, 2013 2:42 am

Re: PowerDNS Recursor Templates [updated 29/7/09]

Post by anuragbhatia »

Hello everyone


This seems to be almost a 1 year old issue. I am having exactly same problem and was wondering if someone found a good fix for it?


snmpwalk -c COMM -v 2c localhost 1.3.6.1.4.1.8072.1.3.2.4

iso.3.6.1.4.1.8072.1.3.2.4.1.2.8.112.100.110.115.45.114.101.99.1 = STRING: "Fatal: Unable to generate local temporary file in directory '/var/run/':
Permission denied"


I really wish to obtain this data via SNMP.
anuragbhatia
Posts: 3
Joined: Thu Dec 05, 2013 2:42 am

Re: PowerDNS Recursor Templates [updated 29/7/09]

Post by anuragbhatia »

Hello!

Anyone?
AdrianBan
Posts: 4
Joined: Wed Feb 05, 2014 8:46 am

Re: PowerDNS Recursor Templates [updated 29/7/09]

Post by AdrianBan »

Use SUDO. I got the same problem and I didn't find any solution.

A setup in Debian is like this:

Code: Select all

# cat /etc/sudoers.d/SNMP
User_Alias CUSTOM_USERS = snmp
Cmnd_Alias CUSTOM_CMDS = /usr/bin/rec_control

CUSTOM_USERS ALL = NOPASSWD: CUSTOM_CMDS
And the script provided in this thread is working very good.

Best regards,
Adrian
kirgudu
Posts: 10
Joined: Wed Feb 04, 2009 4:22 am
Location: Moscow, Russia

Re: PowerDNS Recursor Templates [updated 29/7/09]

Post by kirgudu »

If you don't want do use sudo:

From root or pdns user :
crontab -e

Code: Select all

* * * * * /opt/fttb/bin/pdns_stats >/etc/powerdns/statistics/stat0.txt
/etc/snmp/snmpd.conf

Code: Select all

extend  pdns-rec        /bin/cat /etc/powerdns/statistics/stat0.txt
lakenetworksolutions
Posts: 1
Joined: Thu May 29, 2014 8:47 am

Re: PowerDNS Recursor Templates [updated 29/7/09]

Post by lakenetworksolutions »

Hello -
I've been attempting for a couple months now to get this to work without success.

I have.
/sbin/pdns.sh
#!/bin/bash
#
/etc/init.d/pdns dump | awk '{gsub(/,/, "\n");print}' | cut -d "=" -f 2 >/var/run/pdnsstat

the output is:
cat /var/run/pdnsstat
1
0
0
0
313686
105637
1624
0
337398
111995
391
391
0
5
5
0
419339
419340
418948
419339
0
0

SNMP::
extend pdns /bin/pdns.sh /var/run/pdnsstat

When cacti runs I get 'u'

Any suggestions?
TheFuzz
Posts: 1
Joined: Thu Sep 25, 2014 11:13 am

Re: PowerDNS Recursor Templates [updated 29/7/09]

Post by TheFuzz »

I had some trouble getting mine to work on Debian as well. Here is what I did to make it work.

Modify the /etc/snmp/pdns.sh script to the following:

Code: Select all

#!/bin/bash
#
sudo /usr/bin/pdns_control list | awk '{gsub(/,/, "\n");print}' | cut -d "=" -f 2
I'm not sure why the original author was calling the /etc/init.d/pdns scripts. This is much simpler.

Next, modify the /etc/sudoers file, and add the following:

Code: Select all

snmp    ALL=NOPASSWD:/usr/bin/pdns_control
snmp    ALL=NOPASSWD:/usr/bin/rec_control
One can test to make sure that it is working using these commands

Code: Select all

# su - snmp -s /bin/bash
$ /etc/snmp/pdns.sh
13
2839
1299
69
73045
104849
15464
1
297698
223520
84018
84019
0
0
3
0
178319
178320
94301
178320
0
0
$ logout
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests