summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts/adv_graphgen/parse_tinc_anon.py
diff options
context:
space:
mode:
authorEUcancER <root@euer.krebsco.de>2012-06-22 12:50:48 +0200
committerEUcancER <root@euer.krebsco.de>2012-06-22 12:50:48 +0200
commitc691aa0f3842105a153153a021f62385787e34ed (patch)
treeba8ede2d0e8d98eb2e21556c9b97b81db444b9c3 /retiolum/scripts/adv_graphgen/parse_tinc_anon.py
parent589d40b33fa150d007a42d1af65b9f0c417ee7b2 (diff)
make graphite host variable, fix bug
Diffstat (limited to 'retiolum/scripts/adv_graphgen/parse_tinc_anon.py')
-rwxr-xr-xretiolum/scripts/adv_graphgen/parse_tinc_anon.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_anon.py b/retiolum/scripts/adv_graphgen/parse_tinc_anon.py
index c603d398..e0bea913 100755
--- a/retiolum/scripts/adv_graphgen/parse_tinc_anon.py
+++ b/retiolum/scripts/adv_graphgen/parse_tinc_anon.py
@@ -6,11 +6,13 @@ import sys,json
try:
import socket
from time import time
- host = "localhost"
+ import os
+ host = os.environ.get("GRAPHITE_HOST","localhost")
port = 2003
- g_path = "retiolum"
+ g_path = os.environ.get("GRAPHITE_PATH","retiolum")
begin = time()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ sys.stderr.write("connecting to %s:%d"%(host,port))
s.connect((host,port))
except Exception as e:
print >>sys.stderr, "Cannot connect to graphite: " + str(e)
@@ -146,7 +148,7 @@ nodes = delete_unused_nodes(nodes)
write_digraph(nodes)
try:
end = time()
- msg = '%s.graph.anon_build_time %d %d\n' % (g_path,((end-begin)*1000),end)
+ msg = '%s.graph.anon_build_time %d %d\r\n' % (g_path,((end-begin)*1000),end)
s.send(msg)
s.close()
except Exception as e: print >>sys.stderr, e