Shell Scripting
Script to monitor the outgoing ssh connection on a linx machine
(100 is a private n/w so grepping it out)max_ssh_conn=0
while true
do
ssh_conn=`netstat -an|grep -v 127|grep -v "100.1.1"|grep ":22"|grep ESTABLISHED|wc -l`
if [ $ssh_conn -gt $max_ssh_conn ]
then
echo -n "connection increased to "
max_ssh_conn=$ssh_conn
echo $max_ssh_conn
else
echo "connection max seen is " $max_ssh_conn "and current connection level is at" $ssh_conn
fi
sleep 1
done
Comments