Monitoring IO Performance | Free Command |PS Command | View network status |linux under Grab Bag

Source: Internet
Author: User
Tags ack

10.6 Monitoring IO Performance
[[email protected] ~]# iostat -xLinux 3.10.0-514.el7.x86_64 (aminglinux-001)    2018年01月22日     _x86_64_    (2 CPU)avg-cpu:  %user   %nice %system %iowait  %steal   %idle       4.87    0.00    8.42   14.51    0.00   72.20Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %utilsda               0.01     0.74   32.95   10.74   901.28    80.73    44.95     1.19   27.17   22.32   42.04   6.94  30.31 sdb               0.00     0.00    2.39    0.00    14.79     0.00    12.35     0.01    4.12    4.12    0.00   2.40   0.57dm-0              0.00     0.00    0.48    0.00     3.66     0.00    15.20     0.00    2.62    2.62    0.00   2.53   0.12

Focus on%util disk performance

See which is often read and write, using iotop [[email protected] ~]# Yum install-y iotop

10.7free command
        [[email protected] ~]# free        total        used        free      shared  buff/cache   available        Mem:        8002828      183304     7458728        8784      360796     7536660        Swap:       4194300           0     4194300       [[email protected] ~]# free -m       total        used        free      shared  buff/cache   available      Mem:           7815         139        7531           8         144        7454     Swap:          4095           0        4095     [[email protected] ~]# free -h     total        used        free      shared  buff/cache   available      Mem:           7.6G        139M        7.4G        8.5M        144M        7.3G     Swap:          4.0G          0B        4.0G

Just tap a free and then enter to get the total memory size of the current system and the use of memory. From the above example, you can see that the total size of the current system memory is 8002828 (in units of K) already used 183304, the remaining 7458728. In fact, the real surplus is not this 7458728, but the second row of 4194300, the real use of the second row of 0, this is because the system is initialized, it has been allocated a large portion of memory to the cache, which is used at any time to provide program use, if the program is not used, then this part of memory is idle. So, look at how much memory is used and how much is left to see the second row of data. In addition, we can add the-m or-g options to print the memory usage formula in units m or grams, respectively: Total=used+free+buff/cache Avaliab contains free and buffer/cache remainder

10.8ps command

List all the current processes

  [[email protected] ~]# ps aux USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND root         1  0.4  0.0 190660  3584 ?        Ss   22:12   0:06 /usr/lib/systemd/systemd --swit root         2  0.0  0.0      0     0 ?        S    22:12   0:00 [kthreadd] root         3  0.0  0.0      0     0 ?        S    22:12   0:00 [ksoftirqd/0] root         6  0.0  0.0      0     0 ?        S    22:12   0:00 [kworker/u128:0] root         7  0.0  0.0      0     0 ?        S    22:12   0:00 [migration/0] root         8  0.0  0.0      0     0 ?        S    22:12   0:00 [rcu_bh]root         9  0.0  0.0      0     0 ?        S    22:12   0:00 [rcu_sched]root        10  0.0  0.0      0     0 ?        S    22:12   0:00 [watchdog/0]

See if there is a process running in the process

        [[email protected] ~]# ps aux | grep mysql  root      2151  0.0  0.0 112664   972 pts/0    S+   22:39   0:00 grep --color=auto mysql

If you kill the process, you'll need a PID.

[[email protected] ~]# kill 5648[[email protected] ~]# ps aux |grep pickuproot      5828  0.0  0.0 112664   972 pts/2    S+   22:44   0:00 grep --color=auto pickup           

See where a process is up

 [[email protected] ~]# ls -l /proc/1663

Ps-elf is similar, the information displayed is basically the same as PS aux. The meanings of several parameters are described below.

PID: The ID of the process, this ID is very useful, in Linux kernel management process relies on PID to identify and manage a certain process, such as I want to terminate a certain processes, the ' kill process PID sometimes do not kill, you need to add a-9 option kill-9 process PID

STAT: Indicates the status of the process, and the process state is divided into the following types (not required to remember, but to understand)

D a process that cannot be interrupted (usually IO)

R Running Process

The process that S has been interrupted, typically, most of the processes in the system are in this state

T has stopped or paused the process, if we are running a command, say sleep 10 if we press Ctrl-z to let him pause, then we will show the status of T in PS view

W This seems to say that after the kernel 2.6xx, it is expressed as insufficient memory page allocation

X already dead process (this never seems to happen)

Z zombie process, can't kill, fight the garbage process, the system a small resource, but no relationship. If too many, there is a problem. Generally does not appear.

< high-priority processes

N Low-priority processes

L was locked in memory paging

S master Process

L Multithreading Process

Represents a process running in the foreground
This PS command is one of the very many commands used in the work, so remember it. The use of PS commands is often used in conjunction with pipe breaks to view a process or its number.

 [[email protected] ~]# vmstat 1  procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----  r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st  0  0      0 7458604    876 360148    0    0     2     1   19   25  0  0 100  0  0  0  0      0 7458612    876 360148    0    0     0     0   66   68  0  0 100  0  0 0  0      0 7458612    876 360148    0    0     0     0   36   44  0  0 100  0  0  ^Z  [1]+  已停止               vmstat 1  [[email protected] ~]# ps aux |grep vmstat root      5862  0.0  0.0 148308  1352 pts/2    T    15:53   0:00 vmstat 1  root      5864  0.0  0.0 112664   972 pts/2    R+   15:54   0:00 grep --color=auto vmstat  [[email protected] ~]# fg    
10.9. View network status
  [[email protected] ~]# NETSTAT-LNP Active 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 952/sshd TCP 0 0 127.0.0.1:25 0.0.0.0:* LISTEN             1595/master TCP6 0 0::: $:::* LISTEN 952/sshd      TCP6 0 0:: 1:25:::* LISTEN 1595/master UDP 0           0 0.0.0.0:68 0.0.0.0:* 4422/dhclient UDP 0 0 127.0.0.1:323                            0.0.0.0:* 546/chronyd UDP 0 0 0.0.0.0:38180 0.0.0.0:*                                4422/dhclient UDP6 0 0:: 1:323:::*      546/chronyd     UDP6 0 0::: 41347:::* 4422/dhclient raw6 0 0::: 58

The

Netstat command is used to print information such as network connection status, ports open by the system, and routing tables. The most common command about Netstat is that the NETSTAT-LNP (which ports are printed on the current system) and the Netstat-an (Print network connection status) are useful and must be remembered.

  [[email protected] ~]# netstat-an Active Internet connections (servers and established) Proto Recv-q send-q Loca               L Address Foreign address state TCP 0 0 0.0.0.0:22 0.0.0.0:* LISTEN TCP 0 0 127.0.0.1:25 0.0.0.0:* LISTEN TCP 0 52 192.168. 187.130:22 192.168.187.1:51328 established TCP6 0 0::: +:::* LI STEN TCP6 0 0:: 1:25:::* LISTEN UDP 0 0 192.168.187                           .130:39457 108.59.2.24:123 established UDP 0 0 0.0.0.0:68 0.0.0.0:*           UDP 0 0 127.0.0.1:323 0.0.0.0:* UDP 0 0 0.0.0.0:38180 0.0.0.0:* UDP 0 0 192.168.187.130:43156 85.199.214.101:123 establis HED UDP6 0 0:: 1:323:::* udp6 0 0::: 41347:::* RAW6 0 0::: +:::* 7

View numbers for all States

  [[email protected] ~]# netstat -an | awk ‘/^tcp/ {++sta[$NF]} END {for(key in sta) print key,"\t",sta[key]}‘  LISTEN     4   ESTABLISHED   1
10.10 Linux under Grab Bag
[[email protected] ~]# tcpdump -nn -i ens33 -c 3tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on ens33, link-type EN10MB (Ethernet), capture size 65535 bytes 16:59:04.360034 IP 192.168.187.130.22 > 192.168.187.1.51328: Flags [P.], seq 1241162132:1241162344, ack      1047084528, win 273, length 212 16:59:04.361318 IP 192.168.187.1.51328 > 192.168.187.130.22: Flags [.], ack 212, win 16201, length 0  16:59:04.361596 IP 192.168.187.130.22 > 192.168.187.1.51328: Flags [P.], seq 212:504, ack 1, win 273, length 292  3 packets captured   3 packets received by filter  0 packets dropped by kernel

Specify Port 22

  [[email protected] ~]# tcpdump -nn -i ens33  port 22

Specify the package for host

  [[email protected] ~]# tcpdump -nn -i ens33 not port 22 and host 192.168.187.130

Keep the contents of the grab bag in a file

  [[email protected] ~]# tcpdump -nn -i ens33 -c 100 -w /tmp/1.cap

Read this file

   [[email protected] ~]# tcpdump  -r /tmp/1.cap

Packets that can catch the WEB80 port. More practical.

      [[email protected] ~]# tshark -n -t a -R http.request -T fields -e "frame.time" -e "ip.src" -e "http.host" -e "http.request.method" -e "http.request.uri"

Monitoring IO Performance | Free Command |PS Command | View network status |linux under Grab Bag

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.