aboutsummaryrefslogtreecommitdiffstats
path: root/stream/transcode/count.sh
diff options
context:
space:
mode:
authorJoachim Tingvold <joachim@tingvold.com>2014-04-06 03:11:04 +0200
committerJoachim Tingvold <joachim@tingvold.com>2014-04-06 03:11:04 +0200
commit2a0c0a3dbbdf7fa5040953c0b0d88ad6f62c011e (patch)
tree92c7cbf54272466b46f64e5dc8d1ddb429858836 /stream/transcode/count.sh
parentfe0be5960aac1f9bb600dbf853d862a9f4e60de8 (diff)
Initial commit. Source; TG13-goodiebag.
Diffstat (limited to 'stream/transcode/count.sh')
-rwxr-xr-xstream/transcode/count.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/stream/transcode/count.sh b/stream/transcode/count.sh
new file mode 100755
index 0000000..22f6aa1
--- /dev/null
+++ b/stream/transcode/count.sh
@@ -0,0 +1,17 @@
+#!/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
+ for PORT in 3013 5013 3014 5014 3015; do
+ for PROTO in IPv4 IPv6; do
+ # 176.110.x.x / 2a01:798:76a:125:: -> TG12
+ # 176.31.230.19 / 2001:41d0:2:f700::2 -> OVH box
+ cat /var/log/stream-count/$date | grep EST | egrep $PROTO | egrep "(176\.31\.230\.19|2001:41d0:2:f700::.*):$PORT->" | cut -d'>' -f2 | sed 's/:[0-9]\+ (ESTABLISHED)//' | sort -u | grep -vEc 'fisk' | while read foo; do echo "$date $PORT $PROTO foreign $foo"; done | tee -a count_datacube.log
+ cat /var/log/stream-count/$date | grep EST | egrep $PROTO | egrep "(176\.110\..*|2a01:798:76a:125::.*):$PORT->" | cut -d'>' -f2 | sed 's/:[0-9]\+ (ESTABLISHED)//' | sort -u | grep -vEc -e "\[2a01:798:76a:|176\.110\." | while read foo; do echo "$date $PORT $PROTO external $foo"; done | tee -a count_datacube.log
+ cat /var/log/stream-count/$date | grep EST | egrep $PROTO | egrep "(176\.110\..*|2a01:798:76a:125::.*):$PORT->" | cut -d'>' -f2 | sed 's/:[0-9]\+ (ESTABLISHED)//' | sort -u | grep -Ec -e "\[2a01:798:76a:|176\.110\." | while read foo; do echo "$date $PORT $PROTO internal $foo"; done | tee -a count_datacube.log
+ done
+ done
+ sleep 60
+done;
+