diff options
Diffstat (limited to 'retiolum/scripts/adv_graphgen/parse_tinc_anon.py')
-rwxr-xr-x | retiolum/scripts/adv_graphgen/parse_tinc_anon.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_anon.py b/retiolum/scripts/adv_graphgen/parse_tinc_anon.py index 3b0383da..e0bea913 100755 --- a/retiolum/scripts/adv_graphgen/parse_tinc_anon.py +++ b/retiolum/scripts/adv_graphgen/parse_tinc_anon.py @@ -3,6 +3,19 @@ from BackwardsReader import BackwardsReader import sys,json #supernodes= [ "kaah","supernode","euer","pa_sharepoint","oxberg" ] +try: + import socket + from time import time + import os + host = os.environ.get("GRAPHITE_HOST","localhost") + port = 2003 + 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) """ TODO: Refactoring needed to pull the edges out of the node structures again, it should be easier to handle both structures""" DUMP_FILE = "/krebs/db/availability" @@ -133,3 +146,9 @@ def decode_input(FILE): nodes = decode_input(sys.stdin) nodes = delete_unused_nodes(nodes) write_digraph(nodes) +try: + end = time() + 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 |