From 2860ed57fd203716c5cf4b2c5e02e79b5d3dce58 Mon Sep 17 00:00:00 2001 From: euer Date: Thu, 29 Nov 2012 16:39:44 +0100 Subject: add find_super script to find valid supernodes fix stderr issues --- retiolum/scripts/adv_graphgen/parse_tinc_stats.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'retiolum/scripts/adv_graphgen/parse_tinc_stats.py') diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py index 16f4f795..8371ad3d 100755 --- a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py +++ b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py @@ -2,6 +2,7 @@ # -*- coding: utf8 -*- from BackwardsReader import BackwardsReader import sys,json +from find_super import check_super try: from time import time import socket @@ -16,7 +17,10 @@ try: except Exception as e: sys.stderr.write("Cannot connect to graphite: %s\n" % str(e)) -supernodes= [ "kaah","supernode","euer","pa_sharepoint","oxberg" ] +supernodes= [ ] +#supernodes= [ "kaah","supernode","euer","pa_sharepoint","oxberg" ] +for supernode,addr in check_super(): + supernodes.append(supernode) """ 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" @@ -53,8 +57,7 @@ def write_stat_node(nodes): try: msg = '%s.num_nodes %d %d\r\n' %(g_path,num_nodes,begin) s.send(msg) - #print >>sys.stderr, msg - except Exception as e: print sys.stderr,e + except Exception as e: pass #except: pass for k,v in nodes.iteritems(): num_conns+= len(v['to']) @@ -82,8 +85,7 @@ def generate_stats(nodes): jlines.append(jline) lines_to_use -=1 - except Exception,e: - sys.stderr.write(str(e)) + except Exception,e: sys.stderr.write(str(e)) for k,v in nodes.iteritems(): conns = v.get('to',[]) for c in conns: #sanitize weights -- cgit v1.2.3 From 29d8a4e5061d66d0dfeda28a9012992c12a83ccd Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 6 Jan 2013 04:40:20 +0000 Subject: adv_graphgen: add visual warning for nodes with only one connection as this means no redundancy is configured in case the other connected node dies away --- retiolum/scripts/adv_graphgen/parse_tinc_stats.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'retiolum/scripts/adv_graphgen/parse_tinc_stats.py') diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py index 8371ad3d..03a20214 100755 --- a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py +++ b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py @@ -18,12 +18,12 @@ except Exception as e: sys.stderr.write("Cannot connect to graphite: %s\n" % str(e)) supernodes= [ ] -#supernodes= [ "kaah","supernode","euer","pa_sharepoint","oxberg" ] for supernode,addr in check_super(): supernodes.append(supernode) """ 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" + def write_digraph(nodes): """ writes the complete digraph in dot format @@ -173,6 +173,9 @@ def write_node(k,v): node +="\"" if k in supernodes: node += ",fillcolor=steelblue1" + # warning if node only has one connection + elif v['num_conns'] == 1: + node += ",fillcolor=red" #node +=",group=\""+v['external-ip'].replace(".","")+"\"" node += "]" print node -- cgit v1.2.3 From bba5171e63c88ae4b0850adc0a6bf49a55a19662 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 6 Jan 2013 04:43:53 +0000 Subject: adv_graphgen: no redundancy > being supernode it is visually more important to see that a node has no redundancy that to see this node is a potential supernode --- retiolum/scripts/adv_graphgen/parse_tinc_stats.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'retiolum/scripts/adv_graphgen/parse_tinc_stats.py') diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py index 03a20214..76a3ffcd 100755 --- a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py +++ b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py @@ -171,11 +171,12 @@ def write_node(k,v): for addr in v.get('internal-ip',['¯\\\\(°_o)/¯']): node += "internal:"+addr+"\\l" node +="\"" - if k in supernodes: - node += ",fillcolor=steelblue1" + # warning if node only has one connection - elif v['num_conns'] == 1: + if v['num_conns'] == 1: node += ",fillcolor=red" + elif k in supernodes: + node += ",fillcolor=steelblue1" #node +=",group=\""+v['external-ip'].replace(".","")+"\"" node += "]" print node -- cgit v1.2.3