summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts/adv_graphgen/parse_tinc_anon.py
diff options
context:
space:
mode:
authorEUcancER <root@euer.krebsco.de>2012-06-02 01:14:05 +0200
committerEUcancER <root@euer.krebsco.de>2012-06-02 01:14:05 +0200
commitd2f737473e3bbcb7592a6745820bccd333128459 (patch)
tree6c8cfb0f30db5995c0787bbe06f48b6735b65c89 /retiolum/scripts/adv_graphgen/parse_tinc_anon.py
parentff93336964b5c59bb2e7ddfb790884593d8276ba (diff)
//retiolum adv_graphgen: now writing stats to graphite
painload now provides convenient tools to enable graphite stats generation currently logged are: - overall build time of graphs - anon and detailed build times - current number of users in the darknet
Diffstat (limited to 'retiolum/scripts/adv_graphgen/parse_tinc_anon.py')
-rwxr-xr-xretiolum/scripts/adv_graphgen/parse_tinc_anon.py17
1 files changed, 17 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..c603d398 100755
--- a/retiolum/scripts/adv_graphgen/parse_tinc_anon.py
+++ b/retiolum/scripts/adv_graphgen/parse_tinc_anon.py
@@ -3,6 +3,17 @@
from BackwardsReader import BackwardsReader
import sys,json
#supernodes= [ "kaah","supernode","euer","pa_sharepoint","oxberg" ]
+try:
+ import socket
+ from time import time
+ host = "localhost"
+ port = 2003
+ g_path = "retiolum"
+ begin = time()
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ 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 +144,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\n' % (g_path,((end-begin)*1000),end)
+ s.send(msg)
+ s.close()
+except Exception as e: print >>sys.stderr, e