2013年3月28日星期四

实时查看Linux网卡流量Shell脚本

用法为watch -n 1 ./linuxidc.sh即可开始监看流量,按ctrl+c退出。

#!/bin/bash
eth=eth0
RXpre=$(ifconfig ${eth} | grep bytes | awk  '{print $2}'| awk -F":" '{print $2}')
TXpre=$(ifconfig ${eth} | grep bytes | awk '{print $6}' | awk -F":" '{print $2}')
sleep 1
RXnext=$(ifconfig ${eth} | grep bytes | awk  '{print $2}'| awk -F":" '{print $2}')
TXnext=$(ifconfig ${eth} | grep bytes | awk '{print $6}' | awk -F":" '{print $2}')
echo RX ----- TX
echo "$(((${RXnext}-${RXpre})/1024))KB/s   $(((${TXnext}-${TXpre})/1024))KB/s"

没有评论:

发表评论

扩容/dev/mapper/pve-root

.执行 parted /dev/sdq 输入 print 找到要扩容的盘,应该是/dev/sdq3,检查大小 resizepart 3 100% quit 再检查大小 退出parted 更新物理卷的大小,当然这里前提是使用了LVM pvresize /dev/sda3 lvdis...