Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
result=`/usr/sbin/ss -a |grep -v etlservicemgr|awk '{print $2":"$6}'|awk -F ":" '{print $1":"$3}'|sort|uniq -c|sort -nr|head -10`
date=`date "+%Y-%m-%d %H:%M:%S"`
count=0
for i in $result
do
count=$count+1
if((count%2==1))
then
v=$i
else
echo $date" "$i" "$v
fi
done
@php-cpm

This comment has been minimized.

Copy link
Owner Author

php-cpm commented Sep 17, 2018

this is a quick shell script to count on connections in this machine

2018-09-17 15:59:03 TIME-WAIT:6379 9667
2018-09-17 15:59:03 TIME-WAIT:http 8885
2018-09-17 15:59:03 TIME-WAIT:mysql 6876
2018-09-17 15:59:03 ESTAB:memcache 1570
2018-09-17 15:59:03 TIME-WAIT:http-wmap 804
2018-09-17 15:59:03 TIME-WAIT:tns-server 773
2018-09-17 15:59:03 TIME-WAIT:aicc-cmi 662
2018-09-17 15:59:03 TIME-WAIT:appman-server 490
2018-09-17 15:59:03 TIME-WAIT:opsession-prxy 317
2018-09-17 15:59:03 TIME-WAIT:tns-adv 245
2018-09-17 16:00:03 TIME-WAIT:6379 9473
2018-09-17 16:00:03 TIME-WAIT:http 8922
2018-09-17 16:00:03 TIME-WAIT:mysql 7075
2018-09-17 16:00:03 ESTAB:memcache 1573
2018-09-17 16:00:03 TIME-WAIT:http-wmap 782
2018-09-17 16:00:03 TIME-WAIT:tns-server 775
2018-09-17 16:00:03 TIME-WAIT:aicc-cmi 638
2018-09-17 16:00:03 TIME-WAIT:appman-server 453
2018-09-17 16:00:03 TIME-WAIT:opsession-prxy 335
2018-09-17 16:00:03 TIME-WAIT:tns-adv 274
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.