diff options
Diffstat (limited to 'retiolum/scripts')
-rwxr-xr-x | retiolum/scripts/adv_graphgen/parse_tinc_stats.py | 10 | ||||
-rwxr-xr-x | retiolum/scripts/adv_graphgen/sanitize.sh | 7 | ||||
-rwxr-xr-x | retiolum/scripts/adv_graphgen/tinc_stats.py | 3 |
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 |