summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xretiolum/scripts/adv_graphgen/anonytize.sh3
-rwxr-xr-xretiolum/scripts/adv_graphgen/parse_tinc_anon.py2
-rwxr-xr-xretiolum/scripts/adv_graphgen/parse_tinc_stats.py6
-rwxr-xr-xretiolum/scripts/adv_graphgen/sanitize.sh2
-rw-r--r--retiolum/scripts/github_listener/github_listener.conf1
-rwxr-xr-xretiolum/scripts/github_listener/handle_request7
-rwxr-xr-xutil/bin/graphitec3
7 files changed, 17 insertions, 7 deletions
diff --git a/retiolum/scripts/adv_graphgen/anonytize.sh b/retiolum/scripts/adv_graphgen/anonytize.sh
index 2e2045e4..4aad6993 100755
--- a/retiolum/scripts/adv_graphgen/anonytize.sh
+++ b/retiolum/scripts/adv_graphgen/anonytize.sh
@@ -10,7 +10,7 @@ TYPE=svg
TYPE2=png
OPENER=/bin/true
DOTFILE=`mktemp --suffix=anon`
-trap 'rm $DOTFILE' INT TERM KILL
+trap 'rm $DOTFILE' INT TERM KILL EXIT
sudo -E python tinc_stats2json |\
python parse_tinc_anon.py> $DOTFILE
@@ -28,4 +28,3 @@ convert $1/retiolum_1.$TYPE $1/retiolum_1.$TYPE2
#convert -resize 20% $1/retiolum_2.$TYPE $1/retiolum_2.$TYPE2
#convert -resize 20% $1/retiolum_3.$TYPE $1/retiolum_3.$TYPE2
#convert -resize 20% $1/retiolum_4.$TYPE $1/retiolum_4.$TYPE2
-rm $DOTFILE
diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_anon.py b/retiolum/scripts/adv_graphgen/parse_tinc_anon.py
index 21c36e0f..82ee2f2e 100755
--- a/retiolum/scripts/adv_graphgen/parse_tinc_anon.py
+++ b/retiolum/scripts/adv_graphgen/parse_tinc_anon.py
@@ -52,11 +52,13 @@ def write_stat_node(nodes):
''' Write a `stats` node in the corner
This node contains infos about the current number of active nodes and connections inside the network
'''
+ from time import localtime,strftime
num_conns = 0
num_nodes = len(nodes)
for k,v in nodes.iteritems():
num_conns+= len(v['to'])
node_text = " stats_node [shape=box,label=\"Statistics\\l"
+ node_text += "Build Date : %s\\l" % strftime("%Y-%m-%d %H:%M:%S",localtime())
node_text += "Active Nodes: %s\\l" % num_nodes
node_text += "Connections : %s\\l" % num_conns
node_text += "\""
diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
index e5bd96a8..e6a67e2c 100755
--- a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
+++ b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
@@ -54,6 +54,7 @@ def write_stat_node(nodes):
''' Write a `stats` node in the corner
This node contains infos about the current number of active nodes and connections inside the network
'''
+ from time import localtime,strftime
num_conns = 0
num_nodes = len(nodes)
try:
@@ -64,6 +65,7 @@ def write_stat_node(nodes):
for k,v in nodes.iteritems():
num_conns+= len(v['to'])
node_text = " stats_node [label=\"Statistics\\l"
+ node_text += "Build Date : %s\\l" % strftime("%Y-%m-%d %H:%M:%S",localtime())
node_text += "Active Nodes: %s\\l" % num_nodes
node_text += "Connections : %s\\l" % num_conns
node_text += "\""
@@ -172,8 +174,8 @@ def write_node(k,v):
if v.has_key('num_conns'):
node += "Num Connects:"+str(v['num_conns'])+"\\l"
node += "external:"+v['external-ip']+":"+v['external-port']+"\\l"
- for addr in v.get('internal-ip',['¯\\\\(°_o)/¯']):
- node += "internal:"+addr+"\\l"
+ for addr in v.get('internal-ip',['dunno lol']): #['¯\\\\(°_o)/¯']):
+ node += "internal:%s\\l"%addr
node +="\""
# warning if node only has one connection
diff --git a/retiolum/scripts/adv_graphgen/sanitize.sh b/retiolum/scripts/adv_graphgen/sanitize.sh
index 846cc549..c8071dc3 100755
--- a/retiolum/scripts/adv_graphgen/sanitize.sh
+++ b/retiolum/scripts/adv_graphgen/sanitize.sh
@@ -10,7 +10,7 @@ TYPE=svg
TYPE2=png
OPENER=/bin/true
DOTFILE=`mktemp --suffix=san`
-trap 'rm $DOTFILE' INT TERM KILL
+trap 'rm $DOTFILE' INT TERM KILL EXIT
sudo -E python tinc_stats2json |\
python parse_tinc_stats.py > $DOTFILE
diff --git a/retiolum/scripts/github_listener/github_listener.conf b/retiolum/scripts/github_listener/github_listener.conf
index c4f0a8b6..3ab07a21 100644
--- a/retiolum/scripts/github_listener/github_listener.conf
+++ b/retiolum/scripts/github_listener/github_listener.conf
@@ -3,3 +3,4 @@ command=nc -lvv -p 5432 -c "./handle_request /opt/github_listener/retiolum/hosts
user=tinc
directory=/krebs/retiolum/scripts/github_listener/
autorestart=true
+environment=GRAPHITE_HOST=no_omo
diff --git a/retiolum/scripts/github_listener/handle_request b/retiolum/scripts/github_listener/handle_request
index 5b42524a..211ca776 100755
--- a/retiolum/scripts/github_listener/handle_request
+++ b/retiolum/scripts/github_listener/handle_request
@@ -2,11 +2,15 @@
# Possible Shell Vars
# WEBDIR
# HOSTFOLDER
+
set -euf
+export GRAPHITE_HOST=${GRAPHITE_HOST:-no_omo}
+PATH=$PATH:../../../util/bin
if [ "x${2:-}" = x ];then
echo "usage: $0 HOSTDIRECTORY WEBDIRECTORY"
exit 1
fi
+NOW=$(timer)
export HOSTDIR=${1:-../../hosts}
WEBDIR=${2:-/var/www/euer.krebsco.de/retiolum/}
echo "sorry for keeping you waiting, please be patient"
@@ -20,4 +24,5 @@ cd - >&2
../../bin/create-supernode-tar $WEBDIR
echo "almost done..."
../../bin/create-host-tar $WEBDIR
-echo "Thank you for your patience!"
+echo "Thank you for your patience! I stole $(timer $NOW)ms of your time, sorry about that."
+graphitec 'retiolum.pack.build_time' $(timer $NOW)
diff --git a/util/bin/graphitec b/util/bin/graphitec
index b9f09e3d..52aa9834 100755
--- a/util/bin/graphitec
+++ b/util/bin/graphitec
@@ -1,4 +1,5 @@
#!/bin/sh
H=${GRAPHITE_HOST:-localhost}
P=${GRAPHITE_PORT:-2003}
-printf "%s %s\r\n" $1 $2 | nc -u $H $P
+curr=$(date '+%s')
+printf "%s %s %s\n" $1 $2 $curr | nc -q0 $H $P