- bps
while : ; do _T1=$( /sbin/tc -s qdisc | fgrep -m 1 Sent | cut -d" " -f 3); \ sleep 1; _T2=$( /sbin/tc -s qdisc | fgrep -m 1 Sent | cut -d" " -f 3); \ echo "$(expr \( $_T2 - $_T1 \) \* 8 ) bps"; done
- kbps
while : ; do _T1=$( /sbin/tc -s qdisc | fgrep -m 1 Sent | cut -d" " -f 3); \ sleep 1; _T2=$( /sbin/tc -s qdisc | fgrep -m 1 Sent | cut -d" " -f 3); \ echo "$(expr \( \( $_T2 - $_T1 \) \* 8 \) \/ 1024 ) kbps"; done
どのbridgeを利用しているのか確認
# virsh dumpxml test_01|grep vnet <target dev='vnet1'/>
bridgeを指定して実行
i=vnet1 while : ; do _T1=$( grep $i: /proc/net/dev | cut -d: -f 2|awk '{print $1}'); \ sleep 1; _T2=$( grep $i: /proc/net/dev | cut -d: -f 2|awk '{print $1}'); \ echo "$(expr \( $_T2 - $_T1 \) \* 8 ) bps"; done
i=eth0 while : ; do _R1=$( grep $i: /proc/net/dev | cut -d: -f 2|awk '{print $1}'); \ sleep 1; _R2=$( grep $i: /proc/net/dev | cut -d: -f 2|awk '{print $1}'); \ echo Receive "$(expr \( \( $_R2 - $_R1 \) \* 8 \) \/ 1024 ) kbps"; done
i=eth0 while : ; do _T1=$( grep $i: /proc/net/dev | cut -d: -f 2|awk '{print $9}'); \ sleep 1; _T2=$( grep $i: /proc/net/dev | cut -d: -f 2|awk '{print $9}'); \ echo Transmit "$(expr \( \( $_T2 - $_T1 \) \* 8 \) \/ 1024 ) kbps"; done
i=eth0 while : do _R1=$( grep $i: /proc/net/dev | cut -d: -f 2|awk '{print $1}'); \ _T1=$( grep $i: /proc/net/dev | cut -d: -f 2|awk '{print $9}'); \ sleep 1; \ _R2=$( grep $i: /proc/net/dev | cut -d: -f 2|awk '{print $1}'); \ _T2=$( grep $i: /proc/net/dev | cut -d: -f 2|awk '{print $9}'); \ echo -n `date "+[%Y%m%d %H%M%S]"`" "; \ echo -n Receive "$(expr \( \( \( $_R2 - $_R1 \) \* 8 \) \/ 1024 \) \/ 1024 ) Mbps |";\ echo Transmit "$(expr \( \( \( $_T2 - $_T1 \) \* 8 \) \/ 1024 \) \/ 1024 ) Mbps";\ done