http://blog.yam.com/ddy1280/article/2364428
#!/bin/sh
LOGDIR=/home/passant/log
SUBNET=172.16.68.34
while(true)
do
#echo "TOTAL: `netstat -tan | grep tcp | wc -l` connections"
#echo "FROM newsusers: `netstat -tan | grep $SUBNET | cut -f20 -d " " | cut -f1 -d ":" | sort | uniq -c | wc -l` IPs"
#echo "FROM newsusers: `netstat -tan | grep $SUBNET | awk '{print $5}' | cut -f1 -d ":" | sort | uniq -c | wc -l` IPs"
netstat -tan | grep $SUBNET | awk '{print $5}' | cut -f1 -d ":" | sort | uniq -c | wc -l | awk '{print $1}' >> $LOGDIR/$SUBNET-`date +%Y-%m-%d_%H`.log
#netstat -tan | grep $SUBNET | cut -f20 -d " " | cut -f1 -d ":" | sort |uniq -c
#netstat -tan | grep $SUBNET | awk '{print $5}' | cut -f1 -d ":" | sort |uniq -c
sleep 10s
done
沒有留言:
張貼留言