Shell script to view i/0 traffic on a Linux server network

Source: Internet
Author: User

View shell scripts for Linux server network traffic


When uploading a large number of files, you can use this script to implement monitoring!

#!/bin/sh ## #统计5s内的平均流量, if [  "$"  =  " ];then   echo -" in megabytes e  "\n      use interface_name after the script,like  \ "$0 eth0\" ... \ n "   exit -1fi echo -e " \n       start monitoring the $1,press \ "ctrl+c\"  to stop "echo --- -------------------------------------------------------#ls   /etc/sysconfig/network-scripts/|grep  ifcfg|cut -d  "-"  -f 2 while true   do     rx_bytes= ' cat /proc/net/dev|grep  ' $ ' |awk  ' {print $1} ' |cut -d  ': '  -f  2 '    tx_bytes= ' cat /proc/net/dev|grep  "$" |awk  ' {print $9} '      sleep 5    rx_bytes_later= ' cat /proc/net/dev|grep  ' | awk  ' {print $1} ' |CUT&NBsp;-d  ":"  -f 2 '    tx_bytes_later= ' cat /proc/net/dev|grep  "$" |awk   ' {print $9} '     ## #Mb =b*8/1024/1024   speed_rx= ' echo  ' scale=2 ($RX _bytes_later -  $RX _bytes) *8/1024/1024/10 "|BC '    speed_tx= ' echo " scale=2 ($TX _bytes_later -  $TX _bytes) *8/1024/1024/10 "|BC     printf "%-3s  %-3.1f %-10s %-4s %-3.1f %-4s\n " IN:  $speed _rx mb/s out: $ Speed_tx mb/s    done

Use effects such as

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/9E/wKioL1YCbJjRmlVnAAB-OFFQkDo842.jpg "title=" 99.jpg "alt=" Wkiol1ycbjjrmlvnaab-offqkdo842.jpg "/>

This article is from the "struggling People" blog, please be sure to keep this source http://wodemeng.blog.51cto.com/1384120/1697534

Shell script to view i/0 traffic on a Linux server network

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.