linux下监控网络流量的脚本
2013-01-23 15:11
696 查看
[root@74-82-173-217 ~]# cat net.sh
#! /bin/bash
#Author: Vogts WangTao 2008-12-18
#Get summry info
echo "Current Ip: "`/sbin/ifconfig eth0 | grep inet`
echo "Summry info: "`/sbin/ifconfig eth0 | grep bytes`
#sleep 1 second ,monitor eth0
while true
do
receive1=`cat /proc/net/dev|grep eth0 | awk '{print$1}'|sed -s 's/eth0://g'`
receive_pack1=`cat /proc/net/dev|grep eth0 | awk '{print$2}'`
send1=`cat /proc/net/dev|grep eth0 | awk '{print$9}'`
send_pack1=`cat /proc/net/dev|grep eth0 | awk '{print$10}'`
sleep 1
receive2=`cat /proc/net/dev|grep eth0 | awk '{print$1}'|sed -s 's/eth0://g'`
receive_pack2=`cat /proc/net/dev|grep eth0 | awk '{print$2}'`
receive_cnt=`expr $receive2 - $receive1`
receive_pack_cnt=`expr $receive_pack2 - $receive_pack1`
send2=`cat /proc/net/dev|grep eth0 | awk '{print$9}'`
send_pack2=`cat /proc/net/dev|grep eth0 | awk '{print$10}'`
send_cnt=`expr $send2 - $send1`
send_pack_cnt=`expr $send_pack2 - $send_pack1`
echo 'eth0 Receive Bytes:' $receive_cnt ' Packets:' $receive_pack_cnt
echo 'eth0 Send Bytes:' $send_cnt ' Packets:' $send_pack_cnt
done
相关文章推荐
- linux网络流量监控脚本
- Linux 脚本 实现网络流量监控
- linux监控网络流量的脚本
- linux系统CPU,内存,磁盘,网络流量监控脚本
- 监控Linux网络流量的脚本
- linux系统CPU,内存,磁盘,网络流量监控脚本
- linux网络流量的监控脚本
- linux系统CPU,内存,磁盘,网络流量监控脚本
- Linux下网络流量监控工具大全,查看网卡的实时流量脚本
- linux下监控网络流量的脚本
- linux 网络流量监控脚本
- linux网络流量实时监控工具之nload
- 写一个实时监控网络流量的脚本
- Linux下用MRTG监控网络设备端口流量
- Linux下网络流量实时监控
- Linux下网络流量实时监控工具 大全
- Linux下使用Shell对网络流量进行监控
- 18个在Linux下监控网络流量的命令(工具)
- linux网络流量实时监控工具之nload
- nethogs命令_Linux nethogs 命令用法详解:终端下的网络流量监控工具