Quote:
|
Originally Posted by denver1980
I maid a small bash script to use bwm-ng
Code:
Fic_Tmp="/tmp/Fic_Tmp_VerifRatio.tmp"
NbrSec=20
/usr/local/Bwm/bin/bwm-ng -I eth0 -o csv -T avg -C " " -c ${NbrSec} | awk '
BEGIN{
BytesS=0
NbrLecture=0}
/eth0/&&NR>2{
BytesS+=$5/1024
NbrLecture+=1}
END{
Ratio=BytesS/NbrLecture
}
printf ("%4.0f", Ratio)}' > ${Fic_Tmp}
Ratio=$(cat ${Fic_Tmp})
rm ${Fic_Tmp}
if [ "${Ratio}" -lt 110 ];then
echo "BW OK - Moyenne de ${Ratio} de Kb/sec pendant ${NbrSec} secondes"
exit 0
else
echo "BW Surchargé - Moyenne de ${Ratio} de Kb/sec pendant ${NbrSec} secondes"
exit 2
fi
exit $?
It checks my bw on local machine for 20 secs ...
|
Hi, I get the following error:
awk: cmd. line:11: printf ("%4.0f", Ratio)}
awk: cmd. line:11: ^ syntax error
awk: cmd. line:11: printf ("%4.0f", Ratio)}
awk: cmd. line:11: ^ syntax error
Regards,
Paul