From 9dae2851eec97ca41268304b5182e6f4794d5186 Mon Sep 17 00:00:00 2001 From: netkiller Date: Fri, 9 Dec 2016 15:05:44 +0800 Subject: [PATCH] tcpstats --- tcpstats/tcpstats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcpstats/tcpstats b/tcpstats/tcpstats index 40f040f..c88bcc6 100644 --- a/tcpstats/tcpstats +++ b/tcpstats/tcpstats @@ -15,7 +15,7 @@ if [ -f ${CACHE} ]; then fi if [ ! -f ${CACHE} ]; then - ss -ant | awk '{++stats[$1]} END {for(a in stats) print a, stats[a]}' > ${CACHE} + ss -ant | awk 'BEGIN {stats["CLOSE-WAIT"]=0;stats["ESTAB"]=0;stats["FIN-WAIT-1"]=0;stats["FIN-WAIT-2"]=0;stats["LAST-ACK"]=0;stats["SYN-RECV"]=0;stats["SYN-SENT"]=0;stats["TIME-WAIT"]=0} {++stats[$1]} END {for(a in stats) print a, stats[a]}' > ${CACHE} fi grep $1 ${CACHE} | cut -d " " -f2 \ No newline at end of file