10.6 Monitoring IO Performance 10.7 free command 10.8 PS Command 10.9 View network status 10.10 Linux under Grab Bag

Source: Internet
Author: User
Tags disk usage

    • Iostat

Sysstat package includes SAR and Iostat

[Email protected] ~]# Iostat

Linux 3.10.0-693.2.2.el7.x86_64 (centos7.4) January 23, 2018 _x86_64_ (1 CPU)

AVG-CPU:%user%nice%system%iowait%steal%idle

0.41 0.00 0.27 0.01 0.00 99.31

Device:tps kb_read/s kb_wrtn/s Kb_read Kb_wrtn

VDA 0.25 2.04 2.25 1348209 1490248

Iostat 1 always cycles through disk information

Iostat-x disk usage

[Email protected] ~]# iostat-x

Linux 3.10.0-693.2.2.el7.x86_64 (centos7.4) January 23, 2018 _x86_64_ (1 CPU)

AVG-CPU:%user%nice%system%iowait%steal%idle

0.41 0.00 0.27 0.01 0.00 99.31

device:rrqm/s wrqm/s r/s w/s rkb/s wkb/s avgrq-sz avgqu-sz await r_await w_await SVCTM%util

VDA 0.00 0.07 0.04 0.21 2.04 2.25 34.40 0.00 11.22 15.07 10.48 0.46 0.01

Device:sda,sdb,vda disk

rkb/s wkb/s read/write speed

An important indicator:%util

%util indicates the percentage of waiting disk IO

Iotop See which process is reading and writing to disk

Yum Install-y iotop

Iotop disk usage

[Email protected] ~]# Iotop

Total DISK read:0.00 b/S | Total DISK write:0.00 b/S

Actual DISK read:0.00 b/S | Actual DISK write:0.00 b/S

TID PRIO USER disk READ disk WRITE swapin io> COMMAND

1 BE/4 root 0.00 b/S 0.00 B/s 0.00% 0.00% SYSTEMD--switched-root--system--deserialize 21

    • Free

Free to view memory usage

[Email protected] ~]# free-h

Total used free shared buff/cache available

mem:1.8g 530M 140M 14M 1.1G 1.1G

swap:0b 0B 0B

Mem Physical Memory

Swap swap partition

Total: Overall memory size

Used: Memory Used

Free: The remaining memory size

Buff: Buffering

Cache: Caching

Buffer/cache differences:

Read data from disk---> memory (cahche Cache)-----> CPU

CPU-processed Data---> memory (buffer buffer)-----> Disk

FREE-M/G/h

Free-m (MB)

FREE-H (specific data plus units)

Free-g (GB)

Total Memory size formula: Totals = used + Free + Buff/cache

Avaliable contains free and buffer/cache remaining parts

    • Ps

PS View System process

(PS means a snapshot of the reporting system process)

Usage: PS aux, ps-elf

PS aux display system process

[[Email protected] ~]# PS aux

USER PID%cpu%MEM VSZ RSS TTY STAT START time COMMAND

Root 1 0.0 0.2 43388 3824? Ss January 0:03/usr/lib/systemd/systemd--switched

Root 2 0.0 0.0 0 0? S January 0:00 [Kthreadd]

Root 3 0.0 0.0 0 0? S January 0:10 [ksoftirqd/0]

....

PS aux |grep nginx lists the nginx process in the current system process

[[Email protected] ~]# PS aux |grep nginx

Root 11881 0.0 0.0 112676 984 pts/0 r+ 17:55 0:00 grep--color=auto nginx

Root 28467 0.0 0.1 122908 2268? Ss January 0:00 Nginx:master process Nginx

Nginx 28468 0.0 0.1 123296 3588? S January 0:00 Nginx:worker Process

Kill PID kills a process

PID is the process number

See where the process started from

ls/proc/process number (each process has a directory)/

ls/proc/505/

Stat Section Description

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

| Multithreaded processes

+ Foreground Process

What causes the zombie process to occur?

When the parent process is accidentally interrupted, the child processes are left alone, and these child processes are called zombie processes.

Multithreaded processes:

A process is a run of a program, and a process contains multiple threads.

Pausing a process

[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

3 0 0 141648 52672 1144972 0 0 2 2 41 30 0 0 99 0 0

0 0 0 141648 52672 1144972 0 0 0 0 176 345 0 1 99 0 0

0 0 0 141648 52672 1144972 0 0 0 8 171 336 1 0 99 0 0

0 0 0 141260 52672 1144972 0 0 0 0 168 352 0 0 100 0 0

0 0 0 141248 52672 1144972 0 0 0 0 162 368 0 0 100 0 0

^z

[1]+ has stopped Vmstat 1

[[Email protected] ~]# PS aux |grep vmstat

Root 21417 0.0 0.0 148316 1376 pts/0 T 19:13 0:00 vmstat 1

    • Netstat Viewing network status

NETSTAT-LNP Viewing the Listening port

NETSTAT-LTNP Viewing only TCP ports

NETSTAT-LTUNP Viewing only TCP,UDP ports

Netstat-an Viewing the network connection status of the system

NETSTAT-LNTP only look at TCP, not including sockets

Ss-an and Netstat

Skills:

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 3

Established 3

    • Tcpdump

Install Yum install-y tcpdump

Grab Bag tool: tcpdump

Usage: TCPDUMP-NN

The first n indicates the IP display, and if you do not add N, the host name will be displayed.

Listening for specified NIC

Tcpdump-nn-i eth0

[Email protected] ~]# tcpdump-nn-i eth0

Listening on the specified port

Listening to the web port

[[email protected] ~]# TCPDUMP-NN Port 80

Monitor NIC Eth0 Port 80

[Email protected] ~]# tcpdump-nn-i eth0 Port 80

Do not listen on port 22

Tcpdump-nn-i Etho not Port 22

Specifies the package for an IP, not including port 22

Tcpdump-nn-i eth0 not port and host 192.168.1.1

Grab 100 bags and put them in the/tmp/1.cap.

Tcpdump-nn-i eth0-c 100-w/tmp/1.cap

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

Tcpdump:listening on eth0, Link-type EN10MB (Ethernet), capture size 262144 bytes

Packets Captured

102 Packets received by filter

0 packets dropped by kernel

Read Crawl saved package file 1.cap

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

Wire Shark Grab Bag

[email protected] ~]# Yum install-y wireshark

Wireshark inside the Tshark command

can clearly see which IP to visit my site, access to my site what content.

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"

10.6 Monitoring IO Performance 10.7 free command 10.8 PS Command 10.9 View network status 10.10 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.