summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts/adv_graphgen/tinc_stats/Graphite.py
diff options
context:
space:
mode:
Diffstat (limited to 'retiolum/scripts/adv_graphgen/tinc_stats/Graphite.py')
-rw-r--r--retiolum/scripts/adv_graphgen/tinc_stats/Graphite.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/retiolum/scripts/adv_graphgen/tinc_stats/Graphite.py b/retiolum/scripts/adv_graphgen/tinc_stats/Graphite.py
new file mode 100644
index 00000000..ee01a02b
--- /dev/null
+++ b/retiolum/scripts/adv_graphgen/tinc_stats/Graphite.py
@@ -0,0 +1,16 @@
+#!/usr/bin/python
+
+import socket
+from time import time
+
+class GraphiteSender:
+ def __init__(self,host,port=2003,prefix="retiolum"):
+ self.host = host
+ self.port = port
+ self.prefix = prefix
+ self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ self.sock.connect((host,port))
+
+ def send(name,data):
+ from time import time
+ self.sock.send("%s.%s %d %d\r\n"%self.prefix,data,time())