
本文共 4284 字,大约阅读时间需要 14 分钟。
������������������������������������������������������������������Linux������������������������������������������������������������������
������������������sar
������
sar
���System Activity Reporter���������������������������������������������������������������������������������Linux������������sar
���������������������������������������������������������sar
������������������
sar -n DEV 1 2
������������������������������������������������-n
������������������������������������������������������DEV
���������������������EDEV
���������������������NFS
���NFS���������������NFSD
���NFS������������������������������������������������������������������������������������������������������
���������������������������������������������������
Linux 2.6.32-431.el6.x86_64 (CDVM-213017031) 05/04/2017 08:05:30 PMIFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/slo 0.00 0.00 0.00 0.00 0.00 0.00 0.000eth0 1788.00 1923.00 930.47 335.60 0.00 0.00 0.000Average: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.000 eth0 1587.50 1696.00 791.29 296.29 0.00 0.00 0.00
���������������������
rxpck/s
���������������������������������txpck/s
���������������������������������rxkB/s
���txkB/s
���������������������������KB������rxcmp/s
���txcmp/s
������������������������������������������������rxmcst/s
���������������������������������������
������������������������������������
���������������������������������������������������������������������������������������������������������������������Bash���������������
#!/bin/bashethn=$1while truedo RX_pre=$(cat /proc/net/dev | grep $ethn | sed 's/:/ /g' | awk '{print $2}') TX_pre=$(cat /proc/net/dev | grep $ethn | sed 's/:/ /g' | awk '{print $10}') sleep 1 RX_next=$(cat /proc/net/dev | grep $ethn | sed 's/:/ /g' | awk '{print $2}') TX_next=$(cat /proc/net/dev | grep $ethn | sed 's/:/ /g' | awk '{print $10}') clear echo -e "\t RX `date +%k:%M:%S` TX" RX=$((${RX_next}-${RX_pre}) TX=$((${TX_next}-${TX_pre}) if [[ $RX -lt 1024 ]];then RX="${RX}B/s" elif [[ $RX -gt 1048576 ]];then RX=$(echo $RX | awk '{print $1/1048576 "MB/s"}') else RX=$(echo $RX | awk '{print $1/1024 "KB/s"}') fi if [[ $TX -lt 1024 ]];then TX="${TX}B/s" elif [[ $TX -gt 1048576 ]];then TX=$(echo $TX | awk '{print $1/1048576 "MB/s"}') else TX=$(echo $TX | awk '{print $1/1024 "KB/s"}') fi echo -e "$ethn \t $RX $TX "done
���������������������
- ������
/proc/net/dev
������������������������ - ���������������������������������������
- ������������������������������������
- ���������������������������������������������B/s���KB/s���MB/s���
- ���������������������������������������������������������������
- ���Ctrl+C���������������
���������������
net.sh
chmod +x ./net.sh
���������������sh net.sh eth0
������������������cat /proc/net/dev
/proc/net/dev
������������������������������������������������������cat /proc/net/dev
������������������������������������������������
���������
eth0: 1788.00 1923.00 1366157371 3134679052 0 0 0.00 0.00 0 0 0.00 0.00 0 0 0.00 0.00 0 0 0.00 0.00
���������������������
- ������������
- ���������������������
- ���������������
- ������������������ -(pg���������������������)
������������������watch
������������������
watch
���������������������������������������������������������
watch -n 1 "ifconfig eth0" or watch -n 1 "cat /proc/net/dev | grep eth0"
watch
������������������������������������������������������������������������������������������������������
������������
���������������������������������������������
- ������������������������������������������������
sar
��������� - ������������������������������������������������������������������������������
- ���������������������������������������������
cat /proc/net/dev
������������������������������ watch
������������������������������������������������������������
���������������������/proc/net/dev
���������������������������������������������������������������������������������������������
������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
