Linux Base--sar View network card traffic __linux

Source: Internet
Author: User
Tags memory usage
Can monitor all resource states of the system. Average load, network card traffic, disk status, memory usage, and so on. Unlike other system state monitoring tools, it can print historical information that displays the System state information from 0 o'clock to the current time of the day. Yum install-y sysstat Install this command. Up for the first use will be an error, because the SAR tool has not produced the corresponding database files (real-time monitoring will not be an error, because you do not have to query the library file). The database files are in the/var/log/sa/directory. Sar-n Dev #查看当天从零点到当前时间的网卡流量信息 sar-n DEV 1 #每秒显示一次 10 times sar-n dev-f/var/log/sa/saxx #查看xx日的网卡流量历史 sar-q #查看历史负载 Sar-b #查看磁盘读写 1, check the history of the network card key Master #sar-N DEV
Iface indicates that the device name rxpck/s the number of packets received per second TXPCK/S the number of packets sent per second rxkb/s the amount of data received per second, unit KByte 1kb=1000byte=8000bit txkb/s The amount of data emitted per second, unit KByte if services Packet loss is very serious, you need to see whether the network card traffic is abnormal. Receive data part RXPCK is greater than 4000, or RXKB is greater than 5000, then may be attacked, the normal server network card traffic is not so big. Unless you're copying the data yourself. Calculate the actual speed, take the peak of rxkb or TXKB, convert to KB, such as 686KByte, then use 686*8/1000=5.4mbit Bytes Byte, abbreviated as B "the smallest unit of computer hard disk" bit bit, 1byte=8bit "the smallest unit in the network"
bps =bit per second pps =package/Mb per second, GB,10GB 10gb=10000mb "Computer 1G B=1024MB, 1G b=1000mb in Network"
Broadband 10Mb, download speed is 1.25mb,10mb=10mbit 10MBIT/8=1.25MBYTE=1.25MB

2. Check the history of the network card for one day Redhat or CentOS release SAR library files must be in the/var/log/sa/directory. Ls/var/log/sa/found that the following two types of files, sa start plus date, SAR opening plus date, the start of the SA file can not be directly cat, only with sar-f view, the beginning of the SAR can be viewed with cat. SAR command will be recycled every month, this month SA01 view is this month 1th network card traffic, can not see the previous network card traffic. #sar-F/var/log/sa/sadd DD represents a number, 25 indicates 25th, and 29 represents 29th

3, real-time view network card traffic #sar-n DEV 1 5 "Every interval 1 seconds refresh, a total of 5 times" [Root@thinkpad ~]# sar-n DEV 1 5 Linux 2.6.32-431.el6.i686 (ThinkPad) 02/15/17 _i686_ (1 CPU)
23:12:04 iface rxpck/s txpck/s rxkb/s txkb/s rxcmp/s txcmp/s rxmcst/s 23:12:05 Lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 23:12 : Eth0 1.01 0.00 0.06 0.00 0.00 0.00 0.00
4. View historical load #sar-Q 05:40:01 PM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 "1 Minutes" "5 minutes" "15 minutes" 05:50:01 PM 0 0.00 0.00 0.00 Av ERAGE:0 75 0.00 0.00 0.00
5, view disk #sar-B Linux 2.6.32-431.el6.i686 (wangbin) 02/20/2017 _i686_ (1 CPU) "Write per second" "Read per second" 05:40:01 PM TPS Rtps Wtps bread/s BWRTN/S 05:50:01 PM 0.13 0.00 0.13 0.00 1.28 average:0.13 0.00 0.13 0.00 1.28
6, show the state of the CPU #sar-P "-P" or-u, also can not add, SAR default display CPU state "Linux 2.6.32-431.el6.i686 (Wangbin) 02/20/2017 _i686_ (1 CPU)
05:40:01 pm CPU%user%nice%system%iowait%steal%idle 05:50:01 pm All 0.01 0.00 0.25 0.00 0.00 99.74 06:00:02 pm all 0. 0.00 0.44 0.01 0.00 99.53 Average:all 0.02 0.00 0.34 0.00 0.00 99.64

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.