From a7fe1f8e6f98640463a93f934ac2580311db09ca Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Wed, 29 Mar 2017 19:11:23 -0500 Subject: [PATCH] Copy powerdns-recursor to snmp and remove <<>> header (#111) --- snmp/powerdns-recursor | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 snmp/powerdns-recursor diff --git a/snmp/powerdns-recursor b/snmp/powerdns-recursor new file mode 100755 index 0000000..d673738 --- /dev/null +++ b/snmp/powerdns-recursor @@ -0,0 +1,12 @@ +#!/usr/bin/python +import json, subprocess +from subprocess import Popen, PIPE + +input = Popen(['rec_control', 'get-all'], stdout=PIPE).communicate()[0] +data = [] + +for line in input.splitlines(): + item = line.split() + data.append({'name': item[0].decode(), 'value': int(item[1].decode())}) + +print(json.dumps(data))