2020-05-22 07:48:00 +01:00
|
|
|
#!/usr/bin/env python3
|
2021-03-18 12:24:30 +01:00
|
|
|
import json
|
|
|
|
import subprocess
|
|
|
|
from subprocess import PIPE, Popen
|
2016-07-22 15:33:16 -05:00
|
|
|
|
2021-03-18 12:24:30 +01:00
|
|
|
input = Popen(["rec_control", "get-all"], stdout=PIPE).communicate()[0]
|
2016-07-22 15:33:16 -05:00
|
|
|
data = []
|
|
|
|
|
|
|
|
for line in input.splitlines():
|
|
|
|
item = line.split()
|
2021-03-18 12:24:30 +01:00
|
|
|
data.append({"name": item[0].decode(), "value": int(item[1].decode())})
|
2016-07-22 15:33:16 -05:00
|
|
|
|
2021-03-18 12:24:30 +01:00
|
|
|
print("<<<powerdns-recursor>>>")
|
2016-07-22 15:33:16 -05:00
|
|
|
print(json.dumps(data))
|