监控网卡流量脚本
rmail="[email protected]"
N="2000000"
host=`hostname`
while :; do
n=`sar -n DEV 1 2 |grep eth0 | tail -n1 |awk '{print $5}' |cut -d. -f1`
if [ $n -gt $N ] ; then
sar -n DEV 1 |grep eth0 | tail -n1>/tmp/sar.txt
mail -s $host\_flow:`echo $n` $rmail </tmp/sar.txt
sleep 600
fi
sleep 3
done
none