1
0
mirror of https://github.com/librenms/librenms-agent.git synced 2024-05-09 09:54:52 +00:00

Support python2.6 for powerdns scripts

fixes #67
This commit is contained in:
Tony Murray
2016-12-14 16:27:15 -06:00
parent e52776889c
commit 3d061d2407
2 changed files with 5 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python
from subprocess import check_output
from subprocess import Popen, PIPE
vars = [ 'corrupt-packets', 'deferred-cache-inserts', 'deferred-cache-lookup',
'latency', 'packetcache-hit', 'packetcache-miss', 'packetcache-size',
@@ -10,8 +10,9 @@ vars = [ 'corrupt-packets', 'deferred-cache-inserts', 'deferred-cache-lookup',
'udp4-queries', 'udp6-answers', 'udp6-queries' ]
rvars = {}
cmd = ['/usr/bin/pdns_control', 'show', '*']
for l in check_output(['/usr/bin/pdns_control', 'show', '*']).decode().rstrip().split(','):
for l in Popen(cmd, stdout=PIPE).communicate()[0].decode().rstrip().split(','):
v = l.split('=')
if len(v) > 1:
rvars[v[0]] = v[1]

View File

@@ -1,7 +1,8 @@
#!/usr/bin/python
import json, subprocess
from subprocess import Popen, PIPE
input = subprocess.check_output(['rec_control', 'get-all'])
input = Popen(['rec_control', 'get-all'], stdout=PIPE).communicate()[0]
data = []
for line in input.splitlines():