diff options
author | EUcancER <root@euer.krebsco.de> | 2012-06-22 12:50:48 +0200 |
---|---|---|
committer | EUcancER <root@euer.krebsco.de> | 2012-06-22 12:50:48 +0200 |
commit | c691aa0f3842105a153153a021f62385787e34ed (patch) | |
tree | ba8ede2d0e8d98eb2e21556c9b97b81db444b9c3 /retiolum | |
parent | 589d40b33fa150d007a42d1af65b9f0c417ee7b2 (diff) |
make graphite host variable, fix bug
Diffstat (limited to 'retiolum')
-rwxr-xr-x | retiolum/scripts/adv_graphgen/all_the_graphs.sh | 3 | ||||
-rwxr-xr-x | retiolum/scripts/adv_graphgen/parse_tinc_anon.py | 8 | ||||
-rwxr-xr-x | retiolum/scripts/adv_graphgen/parse_tinc_stats.py | 16 |
3 files changed, 16 insertions, 11 deletions
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") |