Monitor IO performance, free command, PS command, view network status, Linux under Grab Bag

Source: Internet
Author: User

Monitoring IO Performance
[[email protected] ~]# iostatLinux 3.10.0-514.el7.x86_64 (localhost.localdomain)     2017年09月12日     _x86_64_    (1 CPU)avg-cpu:  %user   %nice %system %iowait  %steal   %idle           0.11    0.00    0.23    0.01    0.00   99.66Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtnsda               1.61        19.24         1.76     124103      11353sdb               0.07         0.53         0.00       3407          4scd0              0.00         0.01         0.00         44          0dm-0              0.01         0.07         0.00        456          
    • Iostat-x
[[email protected] ~]# iostat -xLinux 3.10.0-514.el7.x86_64 (localhost.localdomain)     2017年09月12日     _x86_64_    (1 CPU)avg-cpu:  %user   %nice %system %iowait  %steal   %idle           0.10    0.00    0.23    0.01    0.00   99.66Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %utilsda               0.00     0.02    1.11    0.42    18.29     1.68    26.04     0.00    0.37    0.34    0.44   0.27   0.04sdb               0.00     0.00    0.07    0.00     0.50     0.00    14.30     0.00    0.09    0.09    1.00   0.08   0.00scd0              0.00     0.00    0.00    0.00     0.01     0.00     8.00     0.00    0.45    0.45    0.00   0.45   0.00dm-0              0.00     0.00    0.01    0.00     0.07     0.00    15.20     0.00    0.08    0.08    0.00   0.07   

Focus on the%util column, if the value is very large, indicating that reading and writing is busy. If the read/write is small, the hard drive is problematic.

    • iotop to see high IO processes

      Not installed: Yum install-y iotop

Total DISK read:0.00 b/S | Total DISK write:0.00 b/sactual DISK read:0.00 b/S |                                                                               Actual disk write:0.00 b/S TID PRIO USER DISK READ disk WRITE swapin io> COMMAND  2434 BE/4 Root 0.00 b/S 0.00 B/S 0.00 0.03 [Kworker/0:2] 1 BE/4 root 0.00 b/S 0.00 B/s 0.00% 0.00% SYSTEMD--switched-root--system--deserialize 2 BE/4 root 0.00 b/S 0.00 B/s 0.00% 0.00% [Kthreadd] 3 BE/4 root 0.00 b/S 0.00 B/S 0.0        0% 0.00% [ksoftirqd/0] 6 BE/4 root 0.00 b/S 0.00 B/s 0.00% 0.00% [kworker/u256:0] 7 RT/4 Root 0.00 B/S 0.00 B/s 0.00% 0.00% [migration/0] 8 BE/4 root 0.00 b/S 0.00 B/s 0.00% 0.00% [RCU_BH ] 9 BE/4 root 0.00 b/S 0.00 B/s 0.00% 0.00% [rcu_sched] RT/4 root 0.00 b/S 0.00 B/S 0.0 0% 0.00% [watchdog/0] be/0 root 0.00 b/S 0.00 B/s 0.00% 0.00% [Khelper] BE/4 root 0.00 b/S 0.00 B/S 0.00% 0.00 [KDEVTMPFS] 14 be/0 Root 0.00 b/S 0.00 B/S 0.00% 0.00 [Netns] BE/4 root 0.00 b/S 0.00 B/S 0.00 0.00 [KHUNGTASKD] be/0 root 0.00 b/S 0.00 B/s 0.00% 0.00% [writeback] be/0 root 0.00 b/S 0.        XX b/s 0.00% 0.00% [Kintegrityd] be/0 root 0.00 b/S 0.00 B/S 0.00% 0.00 [Bioset] be/0 root 0.00 B/S 0.00 B/s 0.00% 0.00% [KBLOCKD] be/0 root 0.00 b/S 0.00 B/S 0.00% 0.00 [MD] 5 BE/4 Root 0.00 b/S 0.00 B/s 0.00% 0.00% VMTOOLSD 534 BE/4 root 0.00 b/S 0.00 B/S 0.00 0.0    0 Systemd-logind BE/4 root 0.00 b/S 0.00 B/s 0.00% 0.00% [kswapd0] BE/5 root 0.00 b/S         0.00 B/S 0.00% 0.00% [KSMD] BE/7 root 0.00 b/S 0.00 B/s 0.00% 0.00% [khugepaged] BE/4 root 0.00 B/S 0.00 b/s 0.00% 0.00% [Fsnotify_mark] be/0 root 0.00 b/S 0.00 B/s 0.00% 0.00% [Crypto] 545 BE/4 root 0.00 B/S 0.00 B/s 0.00% 0.00% agetty--noclear tty1 linux 548 be/4 polkitd 0.00 B/S 0.00 B/S 0.00 % 0.00% POLKITD--no-debug [gmain] be/0 root 0.00 b/S 0.00 B/s 0.00% 0.00% [Kthrotld] BE/4 Roo  T 0.00 B/S 0.00 B/s 0.00% 0.00% [Kworker/u256:1] be/0 root 0.00 b/S 0.00 B/S 0.00 0.00 [KMPATH_RDACD] be/0 root 0.00 b/S 0.00 B/s 0.00% 0.00% [kpsmoused]
Free command

Commands to view memory usage directly

[[email protected] ~]# free              total        used        free      shared  buff/cache   availableMem:         999936      121540      581256        6844      297140      693540Swap:       2097148           0     
[[email protected] ~]# free -h              total        used        free      shared  buff/cache   availableMem:           976M        118M        567M        6.7M        290M        677MSwap:          2.0G          0B        

Buff/cache buffer/cache, cache, is the time the CPU reads data to the hard disk, the cache is in memory. The buffer is: the CPU processed the data to write to the disk, buffer (buff) inside the memory.

Formula: Total=used + Free + buff/cache

The avaliable contains the free and Buffer/cache remaining portions.

PS command
    • PS aux

      Static display of all processes

    • PS aux |grep nginx

      View a process

[[email protected] ~]# ps aux |grep nginxroot       2757  0.0  0.0 112664   968 pts/0    R+   20:57   

PID: Process ID, used to kill a process, kill 2757

View a process: Ls-l/proc/505/

    • PS aux post Focus stat column

      D A process that cannot be interrupted

The process of R run state

The process of the S sleep state

T paused process

Z Zombie Process

< high-priority processes

N Low-priority processes

Memory paging is locked in memory

S master Process

L Multithreading Process

+ Foreground Process

    • Ps-elf

Same as PS aux.

Netstat Viewing network status
    • NETSTAT-LNP Viewing the Listening port
[[email protected] ~]# netstat-lnpactive Internet connections (only servers) Proto recv-q send-q Local Address               Foreign Address State Pid/program name TCP 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 887/sshd TCP 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1494       /master TCP6 0 0::: $:::* LISTEN 887/sshd TCP6 0 0:: 1:25:::* LISTEN 1494/master UDP 0 0 127.0.0.                                1:323 0.0.0.0:* 542/chronyd udp6 0 0:: 1:323:::*           542/chronyd raw6 0 0::: +:::* 7 581/networkmanager Active UNIX domain sockets (only servers) Proto refcnt Flags Type State i-n  Ode Pid/program Name   Pathunix 2 [ACC] STREAM LISTENING 12552 1/systemd/run/systemd/privateunix 2 [     ACC] Stream LISTENING 12561 1/systemd/run/lvm/lvmpolld.socketunix 2 [ACC] Stream LISTENING 19948 1494/master Private/bounceunix 2 [ACC] STREAM LISTENING 19951 14 94/master Private/defer
    • Netstat-an
    • Netstat-an | awk '/^tcp/{++sta[$NF]} END {for (key in STA) print key, "\ T", Sta[key]} '
      [[email protected] ~]# netstat -an | awk ‘/^tcp/ {++sta[$NF]} END {for(key in sta) print key,"\t",sta[key]}‘LISTEN   4ESTABLISHED      1

      Mainly see established, this number is large, indicating that the system is busy. The number of concurrent connections to a website is how many clients are attached at the same time.

Linux under Grab Bag
    • Grab Bag Tool tcpdump

      There is no need to install this command: Yum install-y tcpdump

Specify the NIC name Tcpdump-nn-i ENS33

After running the above command, there will be a dense string of strings, before pressing CTRL + C, these strings have been brushing the screen, the faster the brush screen indicates more packets on the network card. We only need to focus on columns 3rd and 4th, and they show the information for which ip+ port number is connected to which ip+ port number.

The purpose of the-NN option is to have the 3rd and 4th columns appear as "ip+ port Numbers", and if you do not add the-NN option, the host name + service name-I option is followed by the device name.

Tcpdump-nn-i ENS33 Port 22 Specifies a packet that catches only 22 ports

Tcpdump-nn-i ens33 TCP and not port 22 specifies a packet that catches TCP, but does not have a 22 port

Tcpdump-nn-i Ens33 Port 53 catches only 22 and 53 ports of packets.

Tcpdump-nn-i ens33-c 100 catches 100 strips

Tcpdump-nn-i ens33-c 100-w/tmp/1.cap grab 100 strips and save to/tmp/1.cap

Tcpdump-r/tmp/1.cap to view this crawled packet.

    • Grab Bag Tool Wireshark

      Yum Install-y Wireshark

Tshark-n-T a-r http.request-t fields-e "Frame.time"-E "ip.src"-E "http.host"-E "Http.request.method"-E "http.requ Est.uri "

Monitor IO performance, free command, PS command, view network status, Linux under Grab Bag

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.