#! /bin/bash
rmail="15810682591@139.com"
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
编辑回复