summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEUcancER <root@euer.krebsco.de>2011-11-04 13:41:01 +0100
committerEUcancER <root@euer.krebsco.de>2011-11-04 13:41:01 +0100
commitfc5b5f2562cbfd9028f6b77269d123261dae89e9 (patch)
treebaac4f0f766c8f1ccd1025f92c720c772fc42b4d
parent193eaae037623b8843449114a22fc9a25778bcc5 (diff)
//retiolum/adv_graphgen: bug-fixing
debian uses features of adv_graphgen which hasn't been tested until now. Bugs has been fixed concerning usage of LOG_FILE environ and many more fix minor calculation bug in availability calucluation (delete faulty archive lines)
-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 fb238abe..370c59f7 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