diff options
author | root <root@riffraff.tg14.gathering.org> | 2014-04-20 02:58:05 +0200 |
---|---|---|
committer | root <root@riffraff.tg14.gathering.org> | 2014-04-20 02:58:05 +0200 |
commit | 8f4ae8e5833f0d26be5fad5160ae6ee0479b0712 (patch) | |
tree | da5089e91fbe52fd7da57a1c431c9af64f6ac8af /examples/old-stream-stuff/reflect/count-retrofit.sh | |
parent | 37a3b5d6ed97367989aecc875f1db1e9eb0458df (diff) | |
parent | 19cd0064816a577b72577b9f21a5a946eb746f64 (diff) |
Merge branch 'master' of https://github.com/tech-server/tgmanage
Diffstat (limited to 'examples/old-stream-stuff/reflect/count-retrofit.sh')
-rwxr-xr-x | examples/old-stream-stuff/reflect/count-retrofit.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/old-stream-stuff/reflect/count-retrofit.sh b/examples/old-stream-stuff/reflect/count-retrofit.sh new file mode 100755 index 0000000..1ff8c30 --- /dev/null +++ b/examples/old-stream-stuff/reflect/count-retrofit.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +while :; do + date=$(date +"%Y-%m-%d-%H:%M:%S") + #( lsof -n | grep vlc ; ssh root@gaffeltruck.tg12.gathering.org 'lsof -n | grep vlc' ) > /var/log/stream-count/$date + sudo lsof -n | grep vlc > /var/log/stream-count/$date + for PORT in 3013 3014 3015 3016 3017 3018 3019 5013 5015 5019; do + for PROTO in IPv4 IPv6; do + if [ "$PROTO" = "IPv4" ]; then + GREPFOR='151\.216' + else + GREPFOR='2a02:ed02:' + fi + + # 151.216.x.x / 2a02:ed02::/32 -> TG13 + cat /var/log/stream-count/$date | grep EST | egrep $GREPFOR | egrep "(151\.216\..*|2a02:ed02:.*):$PORT->" | cut -d'>' -f2 | sed 's/:[0-9]\+ (ESTABLISHED)//' | sort -u | grep -vEc -e "\[2a02:ed02:|151\.216\." | while read foo; do echo "$date $PORT $PROTO external $foo"; done | tee -a better_datacube.log + cat /var/log/stream-count/$date | grep EST | egrep $GREPFOR | egrep "(151\.216\..*|2a02:ed02:.*):$PORT->" | cut -d'>' -f2 | sed 's/:[0-9]\+ (ESTABLISHED)//' | sort -u | grep -Ec -e "\[2a02:ed02:|151\.216\." | while read foo; do echo "$date $PORT $PROTO internal $foo"; done | tee -a better_datacube.log + done + done + sleep 60 +done; + |