Summary : Number of TCP connections

From: Siddiqui, Ruksana (RSiddiqu@pacificaccess.com.au)
Date: Wed Jun 07 2000 - 20:33:30 CDT


Thanks to all for sending me the script.
List makes life easy.

cheers.

Here is the script.:

#!/usr/bin/sh

touch /tmp/outfile;
rm /tmp/outfile;
touch /tmp/outfile;
chmod 777 /tmp/outfile;

for i in `ndd /dev/tcp \\? | awk '{print $1}'`
do
#echo $i
ndd /dev/tcp $i >> /tmp/outfile
done

echo " "
echo "The number of TCP_LISTEN connections = "
echo " "

nawk 'BEGIN{OFS=" "}; {print $19}' /tmp/outfile | grep TCP_LISTEN | wc
-l

sleep 1;

echo " "
echo "The number of TCP_ESTABLISHED connections = "
echo " "

nawk 'BEGIN{OFS=" "}; {print $19}' /tmp/outfile | grep TCP_ESTABLISHED
| wc -l

sleep 1;

echo " "
echo "The number of TCP_CLOSE_WAIT connections = "
echo " "

nawk 'BEGIN{OFS=" "}; {print $19}' /tmp/outfile | grep TCP_CLOSE_WAIT |
wc -l

sleep 1;

echo " "
echo "The number of TCP_TIME_WAIT connections = "
echo " "

nawk 'BEGIN{OFS=" "}; {print $19}' /tmp/outfile | grep TCP_TIME_WAIT |
wc -l

sleep 1;

echo " "
echo " Thanks for using my script..."
echo " "

echo " Please have a nice day..."

echo " "



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:14:09 CDT