diff --git a/tor-daemon/tor-daemon.py b/tor-daemon/tor-daemon.py
--- a/tor-daemon/tor-daemon.py
+++ b/tor-daemon/tor-daemon.py
#
+#!/usr/bin/env python3
#
+CONTROL_H = "127.0.0.1"
#
+ #cmd, output_name, type, tag/field
#
+ ["traffic/read", "bytes_rx", "int", "field"],
#
+ ["traffic/written", "bytes_rx", "int", "field"],
#
+ ["uptime", "uptime", "int", "field"],
#
+ ["version", "tor_version", "string", "field"],
#
+ ["dormant", "dormant", "int", "field"],
#
+ ["status/reachability-succeeded/or", "orport_reachability", "int", "field"],
#
+ ["status/reachability-succeeded/dr", "dirport_reachability", "int", "field"],
#
+ ["status/version/current", "version_status", "string", "tag"],
#
+ ["network-liveness", "network_liveness", "string", "tag"]
#
+def send_and_respond(sock, command):
#
+ ''' Send a command and return a list of response lines
#
+ if not command.endswith('\n'):
#
+ a = sock.sendall(command.encode())
#
+ data = sock.recv(1024)
#
+ res.append(data.decode())
#
+ except BlockingIOError:
#
+ return ''.join(res).split('\r\n')
#
+def build_lp(measurement_name, state):
#
+ ''' Build a Line Protocol response
#
+ lead = [ measurement_name ]
#
+ lead.append("controlport_connection=" + state['conn_status'])
#
+ for entry in state["stats"]:
#
+ if entry['fieldtype'] == "tag":
#
+ v = entry['name'] + "=" + entry["value"]
#
+ if entry['type'] == "int":
#
+ v = entry['name'] + "=" + entry["value"] + "i"
#
+ elif entry['type'] == "float":
#
+ v = entry['name'] + "=" + entry["value"]
#
+ v = entry['name'] + '="' + entry["value"] + '"'
#
+ return " ".join([l, f])
#
+ "conn_status" : "failed",
#
+# Initialise a connection
#
+s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#
+s.connect((CONTROL_H, int(CONTROL_P)))
#
+cmd = 'AUTHENTICATE "' + AUTH + '"'
#
+res = send_and_respond(s, cmd)
#
+if len(res) < 1 or res[0] != "250 OK":
#
+state["conn_status"] = "success"
#
+# Otherwise, start collecting stats
#
+ cmd = "GETINFO " + stat[0]
#
+ res = send_and_respond(s, cmd)
#
+ if len(res) < 1 or not res[0].startswith("250-"):
#
+ print("Failed to get stat " + stat[0])
#
+ # Otherwise push to the stats list
#
+ val = res[0].split("=")[1]
#
+ state["stats"].append({
#
+ "fieldtype" : stat[3]
#
+print(build_lp(MEASUREMENT, state))