# vi netstat_150.sh
-----------------------------------------------------------------------------------------------------------------------------------------------------
#!/bin/sh
while true; 
do 
date=`/usr/bin/date '+%Y-%m-%d %H:%M:%S'` 
totCnt80=`netstat -na | grep 200.247.29.150.80 | wc -l`
totCnt81=`netstat -na | grep 200.247.29.150.81 | wc -l`
totCnt=`expr $totCnt80 + $totCnt81`

estCnt80=`netstat -na | grep 200.247.29.150.80 | grep EST | wc -l`
estCnt81=`netstat -na | grep 200.247.29.150.81 | grep EST | wc -l`
estCnt=`expr $estCnt80 + $estCnt81`

tomcat00=`netstat -an | grep 127.0.0.1.8009 | wc -l`
tomcat01=`netstat -an | grep 127.0.0.1.8019 | wc -l`
tomcat02=`netstat -an | grep 127.0.0.1.8029 | wc -l`
tomcat03=`netstat -an | grep 127.0.0.1.8039 | wc -l`
tomcat10=`netstat -an | grep 127.0.0.1.18009 | wc -l`
tomcat11=`netstat -an | grep 127.0.0.1.18019 | wc -l`
tomcat12=`netstat -an | grep 127.0.0.1.18029 | wc -l`
tomcat13=`netstat -an | grep 127.0.0.1.18039 | wc -l`
tomcat20=`netstat -an | grep 127.0.0.1.28009 | wc -l`
tomcat21=`netstat -an | grep 127.0.0.1.28019 | wc -l`
tomcat22=`netstat -an | grep 127.0.0.1.28029 | wc -l`
tomcat23=`netstat -an | grep 127.0.0.1.28039 | wc -l`
tomcat30=`netstat -an | grep 127.0.0.1.38009 | wc -l`
tomcat31=`netstat -an | grep 127.0.0.1.38019 | wc -l`
tomcat32=`netstat -an | grep 127.0.0.1.38029 | wc -l`
tomcat33=`netstat -an | grep 127.0.0.1.38039 | wc -l`

echo "${date} : ${estCnt} / ${totCnt} : ${tomcat00} ${tomcat01} ${tomcat02} ${tomcat03} ${tomcat10} ${tomcat11} ${tomcat12} ${tomcat13} ${tomcat20} ${tomcat21} ${tomcat22} ${tomcat23} ${tomcat30} ${tomcat31} ${tomcat32} ${tomcat33}"
sleep 3; 
done
-----------------------------------------------------------------------------------------------------------------------------------------------------

# netstat_150.sh