summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts/adv_graphgen
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2012-06-08 20:34:23 +0200
committermakefu <github@syntax-fehler.de>2012-06-08 20:34:23 +0200
commita0321c82c7f80d1052108c4a1602b775799e4593 (patch)
tree4a9af394716216cf3e56dd022b8f0d30746efac6 /retiolum/scripts/adv_graphgen
parentdd1ba866c0f93500e1d3e4876fc75955be9d976a (diff)
parent6046373ce92a9c9856d828b37cda28af437e36be (diff)
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'retiolum/scripts/adv_graphgen')
-rwxr-xr-xretiolum/scripts/adv_graphgen/all_the_graphs.sh19
-rwxr-xr-xretiolum/scripts/adv_graphgen/anonytize.sh2
-rwxr-xr-xretiolum/scripts/adv_graphgen/parse_tinc_anon.py17
-rwxr-xr-xretiolum/scripts/adv_graphgen/parse_tinc_stats.py26
-rwxr-xr-xretiolum/scripts/adv_graphgen/sanitize.sh2
5 files changed, 59 insertions, 7 deletions
diff --git a/retiolum/scripts/adv_graphgen/all_the_graphs.sh b/retiolum/scripts/adv_graphgen/all_the_graphs.sh
index 36b37f03..1640a446 100755
--- a/retiolum/scripts/adv_graphgen/all_the_graphs.sh
+++ b/retiolum/scripts/adv_graphgen/all_the_graphs.sh
@@ -1,5 +1,14 @@
-#!/bin/sh
-echo "`date` begin all graphs" >> /tmp/build_graph
-cd $(dirname $(readlink -f $0))
-(./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)&
+#!/bin/bash
+
+(
+ echo "`date` begin all graphs" >> /tmp/build_graph
+ cd $(dirname $(readlink -f $0))
+ PATH=$PATH:../../../util/bin/
+ export LOG_FILE=/var/log/retiolum.log
+ begin=`timer`
+ (./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
+ 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 1ebfe972..d49793cb 100755
--- a/retiolum/scripts/adv_graphgen/anonytize.sh
+++ b/retiolum/scripts/adv_graphgen/anonytize.sh
@@ -5,7 +5,7 @@ GRAPH_SETTER1=dot
GRAPH_SETTER2=circo
GRAPH_SETTER3='neato -Goverlap=prism '
GRAPH_SETTER4=sfdp
-LOG_FILE=/var/log/syslog
+LOG_FILE=${LOG_FILE:-/var/log/syslog}
TYPE=svg
TYPE2=png
OPENER=/bin/true
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
diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
index 54dcc4ab..a255a918 100755
--- a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
+++ b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
@@ -2,6 +2,18 @@
# -*- coding: utf8 -*-
from BackwardsReader import BackwardsReader
import sys,json
+try:
+ from time import time
+ import socket
+ 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)
+
supernodes= [ "kaah","supernode","euer","pa_sharepoint","oxberg" ]
""" TODO: Refactoring needed to pull the edges out of the node structures again,
it should be easier to handle both structures"""
@@ -36,6 +48,12 @@ 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)
+ s.send(msg)
+ #print >>sys.stderr, msg
+ except Exception as e: print sys.stderr,e
+ #except: pass
for k,v in nodes.iteritems():
num_conns+= len(v['to'])
node_text = " stats_node [label=\"Statistics\\l"
@@ -183,3 +201,11 @@ try:
except Exception,e:
sys.stderr.write("Cannot dump graph: %s" % str(e))
write_digraph(nodes)
+
+try:
+ end = time()
+ msg = '%s.graph.detail_build_time %d %d\n' % (g_path,((end-begin)*1000),end)
+ s.send(msg)
+ print >>sys.stderr,msg
+ s.close()
+except Exception as e: print >>sys.stderr, e
diff --git a/retiolum/scripts/adv_graphgen/sanitize.sh b/retiolum/scripts/adv_graphgen/sanitize.sh
index 50f1659f..c46662f3 100755
--- a/retiolum/scripts/adv_graphgen/sanitize.sh
+++ b/retiolum/scripts/adv_graphgen/sanitize.sh
@@ -5,7 +5,7 @@ GRAPH_SETTER1=dot
GRAPH_SETTER2=circo
GRAPH_SETTER3='neato -Goverlap=prism '
GRAPH_SETTER4=sfdp
-LOG_FILE=/var/log/syslog
+LOG_FILE=${LOG_FILE:-/var/log/syslog}
TYPE=svg
TYPE2=png
OPENER=/bin/true