diff options
Diffstat (limited to 'retiolum')
9 files changed, 3 insertions, 83 deletions
diff --git a/retiolum/scripts/adv_graphgen/all_the_graphs.sh b/retiolum/scripts/adv_graphgen/all_the_graphs.sh index 381c7aeb..9f3bf82b 100755 --- a/retiolum/scripts/adv_graphgen/all_the_graphs.sh +++ b/retiolum/scripts/adv_graphgen/all_the_graphs.sh @@ -4,17 +4,13 @@ echo "`date` begin all graphs" >> /tmp/build_graph cd $(dirname $(readlink -f $0)) PATH=$PATH:../../../util/bin/ - export LOG_FILE=/var/log/tinc-retiolum.log - export TINC_LEGACY=true EXTERNAL_FOLDER=/var/www/euer.krebsco.de/graphs/retiolum INTERNAL_FOLDER=/var/www/euer/graphs/retiolum begin=`timer` - export GRAPHITE_HOST="no-omo" export GEOCTIYDB="$PWD/GeoLiteCity.dat" (python tinc_stats/Log2JSON.py | python tinc_stats/Geo.py > $INTERNAL_FOLDER/marker.json)& (./anonytize.sh $EXTERNAL_FOLDER && echo "`date` anonytize done" >> /tmp/build_graph)& (./sanitize.sh $INTERNAL_FOLDER && echo "`date` sanitize done" >> /tmp/build_graph)& # wait - graphitec "retiolum.graph.buildtime" "$(timer $begin)" >> /tmp/build_graph echo "`date` end all graphs" >> /tmp/build_graph )& diff --git a/retiolum/scripts/adv_graphgen/anonytize.sh b/retiolum/scripts/adv_graphgen/anonytize.sh index 4c16daf9..04a68869 100755 --- a/retiolum/scripts/adv_graphgen/anonytize.sh +++ b/retiolum/scripts/adv_graphgen/anonytize.sh @@ -5,7 +5,6 @@ GRAPH_SETTER1=dot GRAPH_SETTER2=circo GRAPH_SETTER3='neato -Goverlap=prism ' GRAPH_SETTER4=sfdp -LOG_FILE=${LOG_FILE:-/var/log/syslog} TYPE=svg TYPE2=png OPENER=/bin/true diff --git a/retiolum/scripts/adv_graphgen/sanitize.sh b/retiolum/scripts/adv_graphgen/sanitize.sh index 8da6ec70..f7d0e7e7 100755 --- a/retiolum/scripts/adv_graphgen/sanitize.sh +++ b/retiolum/scripts/adv_graphgen/sanitize.sh @@ -5,7 +5,6 @@ GRAPH_SETTER1=dot GRAPH_SETTER2=circo GRAPH_SETTER3='neato -Goverlap=prism ' GRAPH_SETTER4=sfdp -LOG_FILE=${LOG_FILE:-/var/log/syslog} TYPE=svg TYPE2=png OPENER=/bin/true diff --git a/retiolum/scripts/adv_graphgen/tinc_stats/Availability.py b/retiolum/scripts/adv_graphgen/tinc_stats/Availability.py index a1ef13f1..66defa44 100755 --- a/retiolum/scripts/adv_graphgen/tinc_stats/Availability.py +++ b/retiolum/scripts/adv_graphgen/tinc_stats/Availability.py @@ -20,7 +20,7 @@ def generate_stats(): for line in f: jlines.append(json.loads(line)) f.close() - except Exception,e: + except Exception as e: pass all_nodes = {} for k in get_all_nodes(): diff --git a/retiolum/scripts/adv_graphgen/tinc_stats/Graph.py b/retiolum/scripts/adv_graphgen/tinc_stats/Graph.py index 18c3d545..e78b7795 100644 --- a/retiolum/scripts/adv_graphgen/tinc_stats/Graph.py +++ b/retiolum/scripts/adv_graphgen/tinc_stats/Graph.py @@ -1,6 +1,5 @@ #!/usr/bin/python from BackwardsReader import BackwardsReader -from Graphite import GraphiteSender import sys,json,os from Supernodes import check_all_the_super from Availability import get_node_availability @@ -187,11 +186,6 @@ def anonymize_nodes(nodes): if __name__ == "__main__": supernodes= [] - try: - gr = GraphiteSender(os.environ.get("GRAPHITE_HOST","localhost")) - begin = time() - except Exception as e: - sys.stderr.write( "Cannot connect to graphite: " + str(e)) if len(sys.argv) != 2 or sys.argv[1] not in ["anonymous","complete"]: print("usage: %s (anonymous|complete)") sys.exit(1) @@ -226,6 +220,3 @@ if __name__ == "__main__": print_stat_node(nodes) print ('}') - try: - gr.send("graph.anon_build_time",(time()-begin)*1000) - except Exception as e: pass diff --git a/retiolum/scripts/adv_graphgen/tinc_stats/Graphite.py b/retiolum/scripts/adv_graphgen/tinc_stats/Graphite.py deleted file mode 100644 index 5002d8e5..00000000 --- a/retiolum/scripts/adv_graphgen/tinc_stats/Graphite.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/python - -import socket -from time import time - -class GraphiteSender: - def __init__(self,host,port=2003,prefix="retiolum"): - self.host = host - self.port = port - self.prefix = prefix - self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.sock.connect((host,port)) - - def send(name,data): - # construct a message for graphite, honor the configured prefix - self.sock.send("%s.%s %d %d\r\n"%(self.prefix,name,data,time())) - - def send_raw(path,data): - #ignore the configured prefix, just it to the path given - self.sock.send("%s %d %d\r\n"%(path,data,time())) - -if __name__ == "__main__": - import sys - GraphiteSender(sys.argv[1]).send_raw(sys.argv[2],sys.argv[3]) diff --git a/retiolum/scripts/adv_graphgen/tinc_stats/Log2JSON.py b/retiolum/scripts/adv_graphgen/tinc_stats/Log2JSON.py index 644cbc63..adc869fb 100755 --- a/retiolum/scripts/adv_graphgen/tinc_stats/Log2JSON.py +++ b/retiolum/scripts/adv_graphgen/tinc_stats/Log2JSON.py @@ -57,12 +57,6 @@ def parse_tinc_stats(): elif which("tincctl"): return parse_new_input("tincctl") #old tinc - elif which("tincd"): - # TODO refactor me - subprocess.call(["pkill","-SIGUSR2", "tincd"]) - sleep(1) - return parse_input(get_tinc_block(get_tinc_log_file())) - #no tinc else: raise Exception("no tinc executable found!") @@ -124,43 +118,9 @@ def parse_new_input(tinc_bin): pass #node does not exist return nodes -#@debug -def parse_input(log_data): - nodes={} - for line in log_data: - if BEGIN_NODES in line : - nodes={} - for line in log_data: - if END_NODES in line : - break - l = line.replace('\n','').split() #TODO unhack me - nodes[l[0]]= { 'external-ip': l[2], 'external-port' : l[4] } - if BEGIN_SUBNET in line : - for line in log_data: - if END_SUBNET in line : - break - l = line.replace('\n','').split() - if not nodes[l[2]].get('internal-ip',False): - nodes[l[2]]['internal-ip'] = [] - nodes[l[2]]['internal-ip'].append(l[0].split('#')[0]) - if BEGIN_EDGES in line : - edges = {} - for line in log_data: - if END_EDGES in line : - break - l = line.replace('\n','').split() - if not nodes[l[0]].has_key('to') : - nodes[l[0]]['to'] = [] - nodes[l[0]]['to'].append( - {'name':l[2],'addr':l[4],'port':l[6],'weight' : l[10] }) - return nodes - - if __name__ == '__main__': - # TODO refactor me from sys import argv if len(argv) > 1: usage() else: - print json.dumps(parse_tinc_stats()) - + print (json.dumps(parse_tinc_stats())) diff --git a/retiolum/scripts/adv_graphgen/tinc_stats/Supernodes.py b/retiolum/scripts/adv_graphgen/tinc_stats/Supernodes.py index ae0fae8f..7bb79708 100644 --- a/retiolum/scripts/adv_graphgen/tinc_stats/Supernodes.py +++ b/retiolum/scripts/adv_graphgen/tinc_stats/Supernodes.py @@ -56,4 +56,4 @@ if __name__ == "__main__": usage """ for host,addrs in check_all_the_super(): - print host,addrs + print(host,addrs) diff --git a/retiolum/scripts/adv_graphgen/tinc_stats/__init__.py b/retiolum/scripts/adv_graphgen/tinc_stats/__init__.py index d4a686bf..62f541d1 100644 --- a/retiolum/scripts/adv_graphgen/tinc_stats/__init__.py +++ b/retiolum/scripts/adv_graphgen/tinc_stats/__init__.py @@ -4,4 +4,3 @@ import Log2JSON import Supernodes import Geo import Graph -import Graphite |