From c691aa0f3842105a153153a021f62385787e34ed Mon Sep 17 00:00:00 2001 From: EUcancER Date: Fri, 22 Jun 2012 12:50:48 +0200 Subject: make graphite host variable, fix bug --- retiolum/scripts/adv_graphgen/all_the_graphs.sh | 3 ++- retiolum/scripts/adv_graphgen/parse_tinc_anon.py | 8 +++++--- retiolum/scripts/adv_graphgen/parse_tinc_stats.py | 16 +++++++++------- 3 files changed, 16 insertions(+), 11 deletions(-) (limited to 'retiolum/scripts') diff --git a/retiolum/scripts/adv_graphgen/all_the_graphs.sh b/retiolum/scripts/adv_graphgen/all_the_graphs.sh index 1640a446..5533c722 100755 --- a/retiolum/scripts/adv_graphgen/all_the_graphs.sh +++ b/retiolum/scripts/adv_graphgen/all_the_graphs.sh @@ -6,9 +6,10 @@ PATH=$PATH:../../../util/bin/ export LOG_FILE=/var/log/retiolum.log begin=`timer` + export GRAPHITE_HOST="no_omo" (./anonytize.sh /srv/http/pub/graphs/retiolum/ && echo "`date` anonytize done" >> /tmp/build_graph)& (./sanitize.sh /srv/http/priv/graphs/retiolum/ && echo "`date` sanitize done" >> /tmp/build_graph)& # wait -# graphitec "retiolum.graph.buildtime" "$(timer $begin)" >> /tmp/build_graph + graphitec "retiolum.graph.buildtime" "$(timer $begin)" >> /tmp/build_graph echo "`date` end all graphs" >> /tmp/build_graph )& 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 diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py index a255a918..16f4f795 100755 --- a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py +++ b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py @@ -5,14 +5,16 @@ import sys,json try: from time import time import socket - 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) + sys.stderr.write("Cannot connect to graphite: %s\n" % str(e)) supernodes= [ "kaah","supernode","euer","pa_sharepoint","oxberg" ] """ TODO: Refactoring needed to pull the edges out of the node structures again, @@ -49,7 +51,7 @@ def write_stat_node(nodes): num_conns = 0 num_nodes = len(nodes) try: - msg = '%s.num_nodes %d %d\n' %(g_path,num_nodes,begin) + msg = '%s.num_nodes %d %d\r\n' %(g_path,num_nodes,begin) s.send(msg) #print >>sys.stderr, msg except Exception as e: print sys.stderr,e @@ -204,8 +206,8 @@ write_digraph(nodes) try: end = time() - msg = '%s.graph.detail_build_time %d %d\n' % (g_path,((end-begin)*1000),end) + msg = '%s.graph.detail_build_time %d %d\r\n' % (g_path,((end-begin)*1000),end) s.send(msg) - print >>sys.stderr,msg + sys.stderr.write(msg) s.close() -except Exception as e: print >>sys.stderr, e +except Exception as e: sys.stderr.write( str(e) + "\n") -- cgit v1.2.3