[O & M engineer _ 02] 20 built-in Linux system monitoring tools: vmstat and netstat. This article is the second article and the first article of O & M engineer on the road. See: [O & M tips _ 01] 20 built-in monitoring tools for Linux systems: top gossip, reading and writing O ~ (2) If vmstat is written in front, here Rocky should be a bit cool, privately think that the best practices of vmstat should also be: "which part of the resource is most frequently used?" Let's take a look at vmstat's output [plain] [root @ Rocky ~] # Vmstat 5 3 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 1249892 29292 410624 0 0 143 101 206 2 2 94 2 0 1 0 1249628 29316 410624 0 0 0 60 95 210 2 3 94 1 0 0 1249644 29316 0 0 0 0 0 0 0 0 0 93 189 0 0 100 0 0 ① project [procs] displays the r Related to the process: number of processes waiting for running B: the more blocked processes in the two columns, the more busy the system is. ② project [memory] displays memory-related swpd: Used swap capacity (KB) free: available physical memory (KB) buff: used by the file metadata (KB) cache: size used by the file data (KB) ③ project [swap] displays swap-related si: The size of data read from SWAP to RAM (swap in) (KB/sec) so: size of data written from RAM to SWAP (swap out) (KB/sec) if the si/so ratio is too large, it indicates that the data in the memory is often tumble between the disk and the physical memory, and the system performance is very poor. ④ project [io] shows the bi related to disk read/write: data transmission rate (Block/second) bo: the rate at which data is read from the disk (Block/second) if the value of this part is higher, it indicates that the system I/O is very busy. ⑤ project [system] displays in: the number of interrupted processes per second. cs: the greater the context-changing rate in the process space, the more frequent the communication between the system and the surrounding devices (such as NICs, disks, and time clocks ). [Cpu] displays the CPU load-related us: CPU usage in the user process, and the Oracle process belongs to this kind of sy: CPU usage in the system process id: available CPU usage wa: percentage of consumed on "waiting for I/O" st: Percentage of consumed CPU on the VM. Below are some common usage I once per second, total three times: vmstat 1 3 3 (3) netstat: the best practice of netstat is to show your attitude and view the network connection status. Let's take a look at netstat output: [plain] [root @ localhost ~] # Netstat-lntp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1: 2208 0.0.0.0: * LISTEN 3890 /. /hpiod tcp 0 0.0.0.0: 3306 0.0.0.0: * LISTEN 4055/mysqld tcp 0 0 0.0.0.0: 111 0.0.0.0: * LISTEN 3604/portmap tcp 0 0 192.168.122.1: 53 0.0.0.0: * LISTEN 4379/dnsmasq tcp 0 0 0.0.0.0: 22 0.0.0.0: * LISTEN 3908/sshd tcp 0 0 0.0.0.0: 854 0.0.0.0: * LISTEN 3640/rpc. statd tcp 0 0 127.0.0.1: 631 0.0.0.0: * LISTEN 3021/cupsd tcp 0 0 127.0.0.1: 25 0.0.0.0: * LISTEN 4099/sendmail tcp 0 0 127.0.0.1: 2207 0.0.0.0: * LISTEN 3895/python tcp 0: 5989: * LISTEN 4382/cimservermain tcp 0: 22: * LISTEN 3908/sshd ① Local Address: local IP: PORT ② Foreign Address: remote IP: PORT ③ State: connection status, mainly including [ESTABLISED] [LISTEN] For example: find the network connection that has been monitored on the system and PID [plain] [root @ localhost ~] # Netstat-lntp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1: 2208 0.0.0.0: * LISTEN 3890 /. /hpiod tcp 0 0.0.0.0: 3306 0.0.0.0: * LISTEN 4055/mysqld tcp 0 0 0.0.0.0: 111 0.0.0.0: * LISTEN 3604/portmap tcp 0 0 192.168.122.1: 53 0.0.0.0: * LISTEN 4379/dnsmasq tcp 0 0 0.0.0.0: 22 0.0.0.0: * LISTEN 3908/sshd tcp 0 0 0.0.0.0: 854 0.0.0.0: * LISTEN 3640/rpc. statd tcp 0 0 127.0.0.1: 631 0.0.0.0: * LISTEN 3021/cupsd tcp 0 0 127.0.0.1: 25 0.0.0.0: * LISTEN 4099/sendmail tcp 0 0 127.0.0.1: 2207 0.0.0.0: * LISTEN 3895/python tcp 0: 5989: * LISTEN 4382/cimservermain tcp 0: 22 ::: * LISTEN 3908/sshd: Disable the network service 192.168.122.1: 53 [plain] [root @ localhost ~] # Kill-9 4379 [root @ localhost ~] # Killall-9 dnsmasq