CactiEZ中进出口的平均流量

#!/bin/bash
ipname=$1
pat=${ipname//./_}

eth0=`find / -name $pat*eth0.rrd`
rrdtool fetch $eth0 AVERAGE  -s now-5minutes -e now  > eth0evg.txt
in=`awk '{print $2}' eth0evg.txt | grep [.]`
out=`awk '{print $3}' eth0evg.txt | grep [.]`

eth1=`find / -name $pat*eth1.rrd`
rrdtool fetch $eth1   AVERAGE  -s now-5minutes -e now  > eht1evg.txt
inn=`awk '{print $2}' eht1evg.txt | grep [.]`
outt=`awk '{print $3}' eht1evg.txt | grep [.]`

tcpopen=`find / -name $pat*tcp*.rrd`
rrdtool fetch $tcpopen  AVERAGE  -s now-5minutes -e now  > openevg.txt
open=`awk '{print $2}' openevg.txt | grep [.]`


avgeth0=`echo $in $inn $open | awk '{print (($1 + $2) / $3)}'`
avgeth1=`echo $out $outt $open | awk '{print (($1 + $2) / $3)}'`

echo 进口平均流量为: $avgeth0
echo 出口平均流量为: $avgeth1


#sumavg=`echo $avgeth0 $avgeth1 $open | awk '{print (($1 + $2 ) / $3)}'`
#echo 当前每个人的平均流量为: `echo $sumavg | awk '{print $1 /8 / 1024 / 1024}'`mb

你可能感兴趣的:(职场,休闲,流量,进出口)