summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2011-11-04 14:44:22 +0100
committermakefu <github@syntax-fehler.de>2011-11-04 14:44:22 +0100
commit71698721b593f9857038c35e3ca9c84e2aba4aff (patch)
treeed448658720f5b1833459db63dce347b578c4c01 /retiolum/scripts
parent0dd85c8b1acaebb18a648b0c0b5d4c48b69903d9 (diff)
parentfc5b5f2562cbfd9028f6b77269d123261dae89e9 (diff)
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'retiolum/scripts')
-rwxr-xr-xretiolum/scripts/adv_graphgen/parse_tinc_stats.py10
-rwxr-xr-xretiolum/scripts/adv_graphgen/sanitize.sh7
-rwxr-xr-xretiolum/scripts/adv_graphgen/tinc_stats.py3
3 files changed, 11 insertions, 9 deletions
diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
index c02c9a84..410e5229 100755
--- a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
+++ b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
@@ -49,14 +49,14 @@ def write_stat_node(nodes):
def generate_stats(nodes):
""" Generates some statistics of the network and nodes
"""
+ jlines = []
try:
f = open(DUMP_FILE,'r')
+ for line in f:
+ jlines.append(json.loads(line))
f.close()
except Exception,e:
- f = []
- jlines = []
- for line in f:
- jlines.append(json.loads(line))
+ pass
for k,v in nodes.iteritems():
conns = v.get('to',[])
v['num_conns'] = len(conns)
@@ -81,6 +81,8 @@ def get_node_availability(name,jlines):
uptime = 0
#sys.stderr.write ( "Getting Node availability of %s\n" % name)
for stat in jlines:
+ if not stat['nodes']:
+ continue
ts = stat['timestamp']
if not begin:
begin = last = ts
diff --git a/retiolum/scripts/adv_graphgen/sanitize.sh b/retiolum/scripts/adv_graphgen/sanitize.sh
index 16479304..402ce256 100755
--- a/retiolum/scripts/adv_graphgen/sanitize.sh
+++ b/retiolum/scripts/adv_graphgen/sanitize.sh
@@ -4,14 +4,13 @@ GRAPH_SETTER1=dot
GRAPH_SETTER2=circo
GRAPH_SETTER3='neato -Goverlap=prism '
GRAPH_SETTER4=sfdp
-#LOG_FILE=/var/log/syslog
+LOG_FILE=/var/log/syslog
TYPE=svg
TYPE2=png
OPENER=/bin/true
DOTFILE=`mktemp`
-trap 'rm $DOTFILE' SIGINT SIGTERM
-sudo pkill -USR2 tincd
-sudo python tinc_stats.py |\
+trap 'rm $DOTFILE' SIGTERM
+sudo LOG_FILE=$LOG_FILE python tinc_stats.py |\
python parse_tinc_stats.py > $DOTFILE
$GRAPH_SETTER1 -T$TYPE -o $1/retiolum_1.$TYPE $DOTFILE
diff --git a/retiolum/scripts/adv_graphgen/tinc_stats.py b/retiolum/scripts/adv_graphgen/tinc_stats.py
index 21d03cc4..be3bbbff 100755
--- a/retiolum/scripts/adv_graphgen/tinc_stats.py
+++ b/retiolum/scripts/adv_graphgen/tinc_stats.py
@@ -7,7 +7,8 @@ import json
TINC_NETWORK = os.environ.get("TINC_NETWORK","retiolum")
-SYSLOG_FILE = "/var/log/everything.log"
+os.environ["LOG_FILE"]
+SYSLOG_FILE = os.environ.get("LOG_FILE","/var/log/everything.log")
# Tags and Delimiters