#!/bin/bash echo -n "which nic?" read eth echo "the nic is "$eth echo -n "how much seconds:" read sec echo "duration is "$sec" seconds, wait please..
转载 2010-06-04 15:19:05
1132阅读
#!/bin/bashfunction usage{        echo "use ./test_net.sh ethX time"        echo "$1 is you network interface "   &
原创 2014-11-15 14:33:37
1199阅读
1点赞
#!/bin/bash if [ -n "$1" ]; then   eth_name=$1 else   eth_name="eth0" fi i=0 send_o=`ifconfig $eth_name | grep bytes | awk '{print $6}' | awk -F : '{print $2}'` r
转载 精选 2010-03-04 17:25:52
1084阅读
#! /bin/bash while true do receive1=`ifconfig eth0 |grep 'RX bytes' | awk '{print$2}'|sed -s 's/bytes://g'` echo $receive1 > /dev/null send1=`ifconfig eth0 |grep 'RX bytes' | awk '{print$6}'
原创 2012-08-13 17:31:31
426阅读
说明:此脚本可以监控Linux系统下网卡流量,其中的注释信息本人用多个减号“-”划分开,为了方便这一块功能代码的表示。大家可以下载自己任意修改此脚本。本人属于一级笨鸟级别,希望大家能对脚本不足的地方给出评价。谢谢啦O(∩_∩)O~   #!/bin/bash band () { while true do rx1=$(cat /proc
原创 2012-05-09 21:38:33
2477阅读
2点赞
2评论
本文介绍下,在linux下监控网卡流量的一个shell脚本通过读取/proc/net/dev/中的数据,对网卡流量加以分析。有需要的朋友参考下。在linux中,可以使用命令 cat /proc/net/dev 获取网卡的当前信息。该命令详细列出当前网卡流入流出的字节总数,要监控网络的流量。我们要做的,就是按一定的时间间隔去读取流量信息,然后进行四则运算,得出想要的结果即可。代码如下:——————
翻译 精选 2014-12-11 15:59:27
4737阅读
#!/bin/bashif [ -n "$1" ]; theneth_name=$1elseeth_name="eth0"fii=0send_o=`ifconfig $eth_name | grep bytes | awk '{print $6}' | awk -F : '{print $2}'`recv_o=`ifconfig $eth_name | grep bytes | awk '{pri
转载 2010-07-30 11:13:01
484阅读
#!/bin/bashPATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin;export PATHfunction traffic_monitor {  # 系统版本  OS_NAME=$(sed -n '1p' /etc/issue)  # 网口名  eth=$1  #
转载 精选 2014-09-15 13:30:06
468阅读
#!/bin/bash #eval `date "+day=%d; month=%m; year=%Y; hour=%H; minute=%M second=%S"` #INSTFIL="$year-$month-$day $hour:$minute:$second" #INSTFIL1="$year-$month-$day" #INSTFIL2="$hour:$minute" #INSTFIL3
转载 2014-01-02 16:05:00
115阅读
2评论
linux终端下查看实时流量脚本,可以自行修改为每分钟的流量显示。
原创 2012-01-03 11:09:58
769阅读
#!/bin/bashin_old=$(cat/proc/net/dev|grepeth0|sed's=^.:=='|awk'{print$1}')out_old=$(cat/proc/net/dev|grepeth0|sed's=^.:=='|awk'{print$9}')whiletruedosleep1in=$(cat/proc
原创 2020-08-21 17:45:45
549阅读
语法: bash netmon.sh 网卡名称 [可选参数]我这台云服务最高带宽是2M 所以测试最高也不会超过2MB/s。作用: 实时监控网卡 进/出 流量
原创 2023-06-02 12:05:52
173阅读
job-网卡流量监控 案例需求 网卡发送和就收数据量监控,按秒统计。 思考: 如何获取某块网卡上一秒的流入、流出数据流量 ifconfig中可以获得,你知道吗? 脚本应用场景: 动态监控网卡流量 解决问题 实时掌握网卡流量,掌握带宽使用情况 脚本思路 1、获得网卡当前流入流出总量 2、休息一秒 ...
转载 2021-10-31 12:14:00
774阅读
1点赞
2评论
    有时我们需要较为实时的查看服务器上的网卡流量,这里我写了个shell脚本脚本中用了while true“死循环”,每隔10s从“/proc/net/dev”中取一次值并根据10s内的差值计算10s内的平均带宽;按ctrl+c停止执行。脚本兼容centos6和7,脚本不太复杂,而且脚本中注释也比较细致,所以我就不过多解释脚本内容了。注:1kb=8字
原创 2016-06-07 14:34:29
1380阅读
文章目录查看网卡的实时流量1. 脚本内容2. 运行脚本查看网卡的实时流量一个服务器的流量基本可样的? 1. 输入流量 2. 输出流...
原创 2022-09-05 20:40:07
243阅读
原文:http://www.weiruoyu.cn/?p=349 最近在看流量监控,网上找了很多,感觉写的最好是这个[root@localhost ~]# vi count_net.sh #!/bin/bash # R1=`cat /sys/class/net/eth0/statistics/rx_bytes` T1=`cat /sys/class/net/eth0/statistics/tx_b
转载 精选 2012-08-09 14:52:44
985阅读
最近比较忙,好久没更新博客了,今天刚好不忙写了一个流量监控脚本.测试在centos下已通过,有需要的朋友可以试试,有BUG或者需要添加其他功能话可以给我留言.# vi /etc/rc.d/traffic_monitor.sh----------------------------------------------#!/bin/bashPATH=/bin:/usr/bin:/sbin:/usr/s
推荐 原创 2014-02-26 13:10:24
4677阅读
5点赞
10评论
#!/usr/bin/python##       zhaoyun##import re,time,sys,stringfile = "/proc/net/dev"def get_eth(eth):      
原创 2013-06-29 17:58:19
1402阅读
下面的脚本是一个查看网卡流量的小脚本,分别可以查看进入和出去的,特贴出来分享一下: #this is a scripts of the port's stream #cat stream #!/bin/bash typeset  in_old dif_in dif_in1 typeset  out_old dif_out dif_out1 in_old=$(cat
转载 精选 2009-12-18 18:00:13
1827阅读
1点赞
2评论
  • 1
  • 2
  • 3
  • 4
  • 5