w/uptime 最後面三個數字表示1分鐘,5分鐘,15分鐘平均有多少個進程佔用CPU 佔用CPU的進程能夠是Running,也能夠是Waiting 某一時刻1顆CPU只能有一個進程在使用其資源php
[root@feature1 ~]# w 05:34:38 up 17:27, 2 users, load average: 0.00, 0.02, 0.05 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root pts/0 10.0.2.2 20:36 5:29m 0.19s 0.19s -bash root pts/1 10.0.2.2 20:39 6.00s 0.20s 0.04s w
[root@feature1 ~]# uptime # 1分鐘 5分鐘 10分鐘 05:40:19 up 17:33, 2 users, load average: 0.00, 0.01, 0.05
top 回車就能夠進入到top界面 每3秒刷新一次 默認按cpu百分比排序,能夠按M鍵按照內存使用率大小排序 按數字1,能夠顯示全部CPU使用率詳情java
[root@feature1 ~]# top # 按M 是按照內存來排序 默認是按照CPU排序的 # 按數字1 能夠顯示全部CPU使用率 top - 05:43:37 up 17:36, 2 users, load average: 0.11, 0.04, 0.05 Tasks: 104 total, 1 running, 103 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.5 us, 0.0 sy, 0.0 ni, 99.5 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st # us用戶級別進程 sy系統級別進程id 空閒的使用率 KiB Mem : 1857724 total, 894112 free, 357608 used, 606004 buff/cache KiB Swap: 2097148 total, 2097148 free, 0 used. 1307968 avail Mem #avail Mem 真正能使用的的內存 PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND # VIRT虛擬內存 RES物理內存 1400 root 20 0 0 0 0 S 0.5 0.0 0:43.99 xfsaild/dm-0 7214 root 20 0 162016 2248 1560 R 0.5 0.1 0:00.03 top 1 root 20 0 128172 6720 4176 S 0.0 0.4 0:02.98 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.07 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:00.84 ksoftirqd/0 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H 6 root 20 0 0 0 0 S 0.0 0.0 0:01.30 kworker/u2:0 7 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh 9 root 20 0 0 0 0 S 0.0 0.0 0:01.35 rcu_sched 10 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 lru-add-drain 11 root rt 0 0 0 0 S 0.0 0.0 0:00.78 watchdog/0 13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs 14 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns 15 root 20 0 0 0 0 S 0.0 0.0 0:00.02 khungtaskd 16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 writeback 17 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kintegrityd 18 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset 19 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset 20 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset 21 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kblockd 22 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 md 23 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 edac-poller 24 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 watchdogd 30 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kswapd0 31 root 25 5 0 0 0 S 0.0 0.0 0:00.00 ksmd 32 root 39 19 0 0 0 S 0.0 0.0 0:00.77 khugepaged 33 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 crypto 41 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kthrotld 43 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kmpath_rdacd 44 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kaluad 45 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kpsmoused 46 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ipv6_addrconf 60 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 deferwq 91 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kauditd 749 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ata_sff 1129 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_0 1132 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 scsi_tmf_0 1135 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_1 1136 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 scsi_tmf_1
top -bn1 靜態顯示全部進程的狀況,也是按cpu百分比排序 靜態顯示進程信息,方便在shell腳本中使用top命令node
[root@feature1 ~]# top -bn1 top - 05:59:03 up 17:52, 2 users, load average: 0.00, 0.01, 0.05 Tasks: 104 total, 1 running, 103 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 6.2 sy, 0.0 ni, 93.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1857724 total, 894112 free, 357612 used, 606000 buff/cache KiB Swap: 2097148 total, 2097148 free, 0 used. 1307968 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1 root 20 0 128172 6720 4176 S 0.0 0.4 0:02.98 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.07 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:00.84 ksoftirqd/0 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H 6 root 20 0 0 0 0 S 0.0 0.0 0:01.31 kworker/u2:0 7 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh 9 root 20 0 0 0 0 S 0.0 0.0 0:01.35 rcu_sched 10 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 lru-add-drain 11 root rt 0 0 0 0 S 0.0 0.0 0:00.79 watchdog/0 13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs 14 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns 15 root 20 0 0 0 0 S 0.0 0.0 0:00.02 khungtaskd 16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 writeback 17 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kintegrityd 18 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset 19 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset 20 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset 21 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kblockd 22 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 md 23 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 edac-poller 24 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 watchdogd 30 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kswapd0 31 root 25 5 0 0 0 S 0.0 0.0 0:00.00 ksmd 32 root 39 19 0 0 0 S 0.0 0.0 0:00.77 khugepaged 33 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 crypto 41 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kthrotld 43 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kmpath_rdacd 44 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kaluad 45 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kpsmoused 46 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ipv6_addrconf 60 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 deferwq 91 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kauditd 749 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ata_sff 1129 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_0 1132 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 scsi_tmf_0 1135 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_1 1136 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 scsi_tmf_1 1139 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_2 1141 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 scsi_tmf_2 1145 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ttm_swap 1148 root -51 0 0 0 0 S 0.0 0.0 0:00.00 irq/18-vmwgfx 1285 root 0 -20 0 0 0 S 0.0 0.0 0:00.92 kworker/0:1H 1341 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kdmflush 1342 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset 1357 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kdmflush 1358 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset 1376 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset 1381 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfsalloc 1386 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs_mru_cache 1389 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-buf/dm-0 1392 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-data/dm-0 1395 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-conv/dm-0 1396 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-cil/dm-0 1397 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-reclaim/dm- 1398 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-log/dm-0 1399 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-eofblocks/d 1400 root 20 0 0 0 0 S 0.0 0.0 0:44.73 xfsaild/dm-0 1468 root 20 0 39076 2896 2560 S 0.0 0.2 0:00.56 systemd-journal 1493 root 20 0 127348 4132 2620 S 0.0 0.2 0:00.43 lvmetad 1499 root 20 0 47416 4796 2860 S 0.0 0.3 0:00.23 systemd-udevd 2294 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-buf/sda1 2300 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-data/sda1 2304 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-conv/sda1 2309 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-cil/sda1 2314 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-reclaim/sda 2320 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-log/sda1 2326 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-eofblocks/s 2332 root 20 0 0 0 0 S 0.0 0.0 0:00.00 xfsaild/sda1 2680 root 16 -4 62044 1084 496 S 0.0 0.1 0:00.08 auditd 2718 dbus 20 0 66460 2656 1896 S 0.0 0.1 0:00.80 dbus-daemon 2720 chrony 20 0 117784 1816 1356 S 0.0 0.1 0:00.84 chronyd 2727 polkitd 20 0 612996 14024 4980 S 0.0 0.8 0:00.23 polkitd 2729 root 20 0 26376 1752 1448 S 0.0 0.1 0:00.25 systemd-logind 2737 root 20 0 126284 1688 1056 S 0.0 0.1 0:00.57 crond 2768 root 20 0 110092 860 728 S 0.0 0.0 0:00.00 agetty 2772 root 20 0 362180 33428 7088 S 0.0 1.8 0:03.77 firewalld 2774 root 20 0 473588 8460 6500 S 0.0 0.5 0:01.83 NetworkManager 3254 root 20 0 573828 17092 6016 S 0.0 0.9 0:10.30 tuned 3255 root 20 0 112756 4348 3320 S 0.0 0.2 0:00.06 sshd 3257 root 20 0 222748 3852 3020 S 0.0 0.2 0:05.78 rsyslogd 3301 root 20 0 115436 1752 1408 S 0.0 0.1 0:00.02 mysqld_safe 3314 root 20 0 230472 6216 1068 S 0.0 0.3 0:15.31 php-fpm 3330 php-fpm 20 0 230472 6352 1200 S 0.0 0.3 0:00.00 php-fpm 3331 php-fpm 20 0 230472 6352 1200 S 0.0 0.3 0:00.00 php-fpm 3495 mysql 20 0 1255340 89712 10796 S 0.0 4.8 0:34.49 mysqld 3794 root 20 0 89544 2164 1124 S 0.0 0.1 0:00.38 master 3796 postfix 20 0 89716 4096 3088 S 0.0 0.2 0:00.07 qmgr 5732 root 20 0 113308 696 384 S 0.0 0.0 0:00.00 catalina.sh 5733 root 20 0 2542548 140564 14732 S 0.0 7.6 1:44.50 java 6320 root 20 0 0 0 0 S 0.0 0.0 0:00.03 kworker/u2:2 6355 root 20 0 158744 5984 4628 S 0.0 0.3 0:01.82 sshd 6360 root 20 0 115572 2200 1672 S 0.0 0.1 0:00.19 bash 6403 root 20 0 158744 5988 4628 S 0.0 0.3 0:01.20 sshd 6407 root 20 0 115572 2204 1672 S 0.0 0.1 0:00.17 bash 6535 root 20 0 202492 1200 180 S 0.0 0.1 0:00.00 pure-ftpd 6671 root 20 0 46452 1124 0 S 0.0 0.1 0:00.00 nginx 6672 nginx 20 0 46944 2080 532 S 0.0 0.1 0:00.00 nginx 7184 postfix 20 0 89648 4064 3068 S 0.0 0.2 0:00.01 pickup 7207 root 20 0 0 0 0 S 0.0 0.0 0:00.89 kworker/0:1 7216 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kworker/0:3 7217 root 20 0 0 0 0 S 0.0 0.0 0:00.08 kworker/0:0 7218 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/0:2 7219 root 20 0 161880 2104 1536 R 0.0 0.1 0:00.00 top
[root@feature1 ~]# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 78 model name : Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz stepping : 3 cpu MHz : 2400.002 cache size : 3072 KB physical id : 0 siblings : 1 core id : 0 cpu cores : 1 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 22 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc eagerfpu pni pclmulqdq monitor ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase avx2 invpcid rdseed clflushopt bogomips : 4800.00 clflush size : 64 cache_alignment : 64 address sizes : 39 bits physical, 48 bits virtual power management:
[root@feature1 ~]# lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 1 On-line CPU(s) list: 0 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 78 Model name: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz Stepping: 3 CPU MHz: 2400.002 BogoMIPS: 4800.00 Hypervisor vendor: KVM Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 3072K NUMA node0 CPU(s): 0 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc eagerfpu pni pclmulqdq monitor ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase avx2 invpcid rdseed clflushopt
free查看內存和swap使用狀況,關注最後一列的available,這個數字是真正剩餘的物理內存大小python
[root@feature1 ~]# free total used free shared buff/cache available Mem: 1857724 357240 894228 8804 606256 1308324 Swap: 2097148 0 2097148
[root@feature1 ~]# free -k -m -g -h total used free shared buff/cache available Mem: 1.8G 348M 873M 8.6M 592M 1.2G Swap: 2.0G 0B 2.0G
[root@feature1 ~]# dd if=/dev/zero of=/bigfile bs=1M count=1000 1000+0 records in 1000+0 records out 1048576000 bytes (1.0 GB) copied, 3.54063 s, 296 MB/s [root@feature1 ~]# mkswap /bigfile Setting up swapspace version 1, size = 1023996 KiB no label, UUID=1e79c4bf-b46e-4cba-a98e-8c67a85f23a2 [root@feature1 ~]# chmod 600 /bigfile [root@feature1 ~]# swapon /bigfile
iostat --> yum install -y sysstatmysql
[root@feature1 ~]# iostat Linux 3.10.0-957.el7.x86_64 (feature1) 02/20/2019 _x86_64_ (1 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 0.31 0.00 0.11 0.01 0.00 99.57 Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn sda 0.42 6.33 20.60 423804 1379855 dm-0 0.41 5.85 20.57 391506 1377758 dm-1 0.00 0.04 0.00 2460 8
iostat -dx 1 iostat -dx 1 5
[root@feature1 ~]# 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 -~rialize 22 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.00 % 0.00 % [ksoftirqd/0] 5 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kworker/0:0H] 6 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kworker/u2: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] 10 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [lru-add-drain] 11 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [watchdog/0] 13 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] 15 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [khungtaskd] 16 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [writeback] 17 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kintegrityd] 18 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [bioset] 19 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [bioset] 20 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [bioset] 21 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kblockd] 22 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [md]
綜合工具,判定瓶頸點:ios
vmstat 1 vmstat 1 10nginx
[root@feature1 ~]# vmstat 1 10 procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 2 0 8 157280 164 1341924 0 0 6 20 51 127 0 0 100 0 0 0 0 8 157256 164 1341924 0 0 0 0 56 129 1 0 99 0 0 0 0 8 157256 164 1341924 0 0 0 0 46 121 0 0 100 0 0 0 0 8 157256 164 1341924 0 0 0 1 50 134 0 0 100 0 0 0 0 8 157256 164 1341924 0 0 0 0 47 130 0 0 100 0 0 0 0 8 157256 164 1341924 0 0 0 0 41 116 0 0 100 0 0 0 0 8 157256 164 1341924 0 0 0 0 42 117 0 1 99 0 0 0 0 8 157256 164 1341924 0 0 0 0 41 118 0 0 100 0 0 0 0 8 157256 164 1341924 0 0 0 0 37 114 0 0 100 0 0 0 0 8 157256 164 1341924 0 0 0 0 40 121 0 1 99 0 0
關注:r、b、si、so、bi、bo、id、wasql
# si= swap in ==從swap出來進入到內存裏
bit比特 (帶寬單位)Byte字節(速度傳輸單位) 100Mb帶寬 Mbit MByte 9bit-1Byte 2MB/s 2*8=16Mbit 100Mbit=12.8MB/sshell
[root@feature1 ~]# sar -n DEV 1 10 Linux 3.10.0-957.el7.x86_64 (feature1) 02/20/2019 _x86_64_ (1 CPU) 07:47:54 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 07:47:55 AM enp0s3 1.00 1.00 0.06 0.18 0.00 0.00 0.00 07:47:55 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 07:47:55 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 07:47:56 AM enp0s3 0.99 0.99 0.06 0.38 0.00 0.00 0.00 07:47:56 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 07:47:56 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 07:47:57 AM enp0s3 1.02 1.02 0.06 0.39 0.00 0.00 0.00 07:47:57 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 07:47:57 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 07:47:58 AM enp0s3 1.01 1.01 0.06 0.38 0.00 0.00 0.00 07:47:58 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 07:47:58 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 07:47:59 AM enp0s3 1.00 1.00 0.06 0.38 0.00 0.00 0.00 07:47:59 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 07:47:59 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 07:48:00 AM enp0s3 1.01 1.01 0.06 0.38 0.00 0.00 0.00 07:48:00 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 07:48:00 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 07:48:01 AM enp0s3 1.00 1.00 0.06 0.38 0.00 0.00 0.00 07:48:01 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 07:48:01 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 07:48:02 AM enp0s3 1.02 1.02 0.06 0.39 0.00 0.00 0.00 07:48:02 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 07:48:02 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 07:48:03 AM enp0s3 1.00 1.00 0.06 0.38 0.00 0.00 0.00 07:48:03 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 07:48:03 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 07:48:04 AM enp0s3 1.01 1.01 0.06 0.38 0.00 0.00 0.00 07:48:04 AM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 Average: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s Average: enp0s3 1.01 1.01 0.06 0.36 0.00 0.00 0.00 Average: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
[root@feature1 ~]# sar -f /var/log/sa/sa20 Linux 3.10.0-957.el7.x86_64 (feature1) 02/20/2019 _x86_64_ (1 CPU) 06:50:02 AM CPU %user %nice %system %iowait %steal %idle 07:00:01 AM all 0.64 0.00 0.21 0.02 0.00 99.13 07:10:01 AM all 0.03 0.00 0.07 0.00 0.00 99.89 07:20:01 AM all 0.02 0.00 0.06 0.00 0.00 99.91 07:30:01 AM all 0.03 0.00 0.08 0.00 0.00 99.89 07:40:01 AM all 0.07 0.00 0.11 0.00 0.00 99.82 07:50:02 AM all 0.37 0.00 0.23 0.00 0.00 99.40 Average: all 0.19 0.00 0.13 0.01 0.00 99.67
#查看磁盤的讀寫 [root@feature1 ~]# sar -b Linux 3.10.0-957.el7.x86_64 (feature1) 02/20/2019 _x86_64_ (1 CPU) 06:50:02 AM tps rtps wtps bread/s bwrtn/s 07:00:01 AM 0.73 0.08 0.65 8.69 12.08 07:10:01 AM 0.20 0.02 0.18 0.46 1.92 07:20:01 AM 0.13 0.00 0.13 0.00 1.25 07:30:01 AM 0.14 0.00 0.14 0.00 1.28 07:40:01 AM 0.16 0.00 0.16 0.00 1.60 07:50:02 AM 0.26 0.00 0.26 0.00 3.19 Average: 0.27 0.02 0.25 1.52 3.55
# 查看歷史系統的負載 [root@feature1 ~]# sar -q Linux 3.10.0-957.el7.x86_64 (feature1) 02/20/2019 _x86_64_ (1 CPU) 06:50:02 AM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 07:00:01 AM 1 190 0.00 0.01 0.05 0 07:10:01 AM 3 190 0.00 0.01 0.05 0 07:20:01 AM 1 191 0.01 0.03 0.05 0 07:30:01 AM 3 191 0.00 0.01 0.05 0 07:40:01 AM 2 190 0.00 0.01 0.05 0 07:50:02 AM 1 190 0.04 0.03 0.05 0 Average: 2 190 0.01 0.02 0.05 0
yum install -y epel-release yum install nload
Device enp0s3 [10.0.2.20] (1/2): ============================================================================================================= Incoming: Curr: 920.00 Bit/s Avg: 1.24 kBit/s Min: 912.00 Bit/s Max: 2.98 kBit/s Ttl: 24.17 MByte Outgoing: Curr: 8.00 kBit/s Avg: 8.07 kBit/s Min: 4.04 kBit/s Max: 8.85 kBit/s Ttl: 4.50 MByte
# 查看網卡信息 [root@feature1 ~]# ethtool enp0s3 Settings for enp0s3: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: on MDI-X: off (auto) Supports Wake-on: umbg Wake-on: d Current message level: 0x00000007 (7) drv probe link Link detected: yes
#查看網卡是否在鏈接狀態 [root@feature1 ~]# mii-tool enp0s3 enp0s3: no autonegotiation, 1000baseT-FD flow-control, link ok
ps aux 、 ps -elf 、 ps -eLf (查看線程) STAT S Sleep R Running s 父進程 N 低優先級 < 高優先級 + 前臺進程 l 多線程進程 Z 殭屍進程
#STAT 運行狀體 S休眠狀態 R 運行狀態 S<高優先級進程 Ss 表示副進程 l多進程 [root@feature1 ~]# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.3 128172 6740 ? Ss Feb19 0:03 /usr/lib/system root 2 0.0 0.0 0 0 ? S Feb19 0:00 [kthreadd] root 3 0.0 0.0 0 0 ? S Feb19 0:01 [ksoftirqd/0] root 5 0.0 0.0 0 0 ? S< Feb19 0:00 [kworker/0:0H] root 6 0.0 0.0 0 0 ? S Feb19 0:01 [kworker/u2:0] root 7 0.0 0.0 0 0 ? S Feb19 0:00 [migration/0] root 8 0.0 0.0 0 0 ? S Feb19 0:00 [rcu_bh] root 9 0.0 0.0 0 0 ? R Feb19 0:01 [rcu_sched] root 10 0.0 0.0 0 0 ? S< Feb19 0:00 [lru-add-drain] root 11 0.0 0.0 0 0 ? S Feb19 0:00 [watchdog/0] root 13 0.0 0.0 0 0 ? S Feb19 0:00 [kdevtmpfs] root 14 0.0 0.0 0 0 ? S< Feb19 0:00 [netns] root 15 0.0 0.0 0 0 ? S Feb19 0:00 [khungtaskd] root 16 0.0 0.0 0 0 ? S< Feb19 0:00 [writeback] root 17 0.0 0.0 0 0 ? S< Feb19 0:00 [kintegrityd] root 18 0.0 0.0 0 0 ? S< Feb19 0:00 [bioset] root 19 0.0 0.0 0 0 ? S< Feb19 0:00 [bioset] root 20 0.0 0.0 0 0 ? S< Feb19 0:00 [bioset] root 21 0.0 0.0 0 0 ? S< Feb19 0:00 [kblockd] root 22 0.0 0.0 0 0 ? S< Feb19 0:00 [md] root 23 0.0 0.0 0 0 ? S< Feb19 0:00 [edac-poller] root 24 0.0 0.0 0 0 ? S< Feb19 0:00 [watchdogd] root 30 0.0 0.0 0 0 ? S Feb19 0:00 [kswapd0] root 31 0.0 0.0 0 0 ? SN Feb19 0:00 [ksmd] root 32 0.0 0.0 0 0 ? SN Feb19 0:00 [khugepaged] root 33 0.0 0.0 0 0 ? S< Feb19 0:00 [crypto] root 41 0.0 0.0 0 0 ? S< Feb19 0:00 [kthrotld] root 43 0.0 0.0 0 0 ? S< Feb19 0:00 [kmpath_rdacd] root 44 0.0 0.0 0 0 ? S< Feb19 0:00 [kaluad] root 45 0.0 0.0 0 0 ? S< Feb19 0:00 [kpsmoused] root 46 0.0 0.0 0 0 ? S< Feb19 0:00 [ipv6_addrconf] root 60 0.0 0.0 0 0 ? S< Feb19 0:00 [deferwq] root 91 0.0 0.0 0 0 ? S Feb19 0:00 [kauditd] root 749 0.0 0.0 0 0 ? S< Feb19 0:00 [ata_sff] root 1129 0.0 0.0 0 0 ? S Feb19 0:00 [scsi_eh_0] root 1132 0.0 0.0 0 0 ? S< Feb19 0:00 [scsi_tmf_0] root 1135 0.0 0.0 0 0 ? S Feb19 0:00 [scsi_eh_1] root 1136 0.0 0.0 0 0 ? S< Feb19 0:00 [scsi_tmf_1] root 1139 0.0 0.0 0 0 ? S Feb19 0:00 [scsi_eh_2] root 1141 0.0 0.0 0 0 ? S< Feb19 0:00 [scsi_tmf_2] root 1145 0.0 0.0 0 0 ? S< Feb19 0:00 [ttm_swap] root 1148 0.0 0.0 0 0 ? S Feb19 0:00 [irq/18-vmwgfx] root 1285 0.0 0.0 0 0 ? S< Feb19 0:01 [kworker/0:1H] root 1341 0.0 0.0 0 0 ? S< Feb19 0:00 [kdmflush] root 1342 0.0 0.0 0 0 ? S< Feb19 0:00 [bioset] root 1357 0.0 0.0 0 0 ? S< Feb19 0:00 [kdmflush] root 1358 0.0 0.0 0 0 ? S< Feb19 0:00 [bioset] root 1376 0.0 0.0 0 0 ? S< Feb19 0:00 [bioset] root 1381 0.0 0.0 0 0 ? S< Feb19 0:00 [xfsalloc] root 1386 0.0 0.0 0 0 ? S< Feb19 0:00 [xfs_mru_cache] root 1389 0.0 0.0 0 0 ? S< Feb19 0:00 [xfs-buf/dm-0] root 1392 0.0 0.0 0 0 ? S< Feb19 0:00 [xfs-data/dm-0] root 1395 0.0 0.0 0 0 ? S< Feb19 0:00 [xfs-conv/dm-0] root 1396 0.0 0.0 0 0 ? S< Feb19 0:00 [xfs-cil/dm-0] root 1397 0.0 0.0 0 0 ? S< Feb19 0:00 [xfs-reclaim/dm root 1398 0.0 0.0 0 0 ? S< Feb19 0:00 [xfs-log/dm-0] root 1399 0.0 0.0 0 0 ? S< Feb19 0:00 [xfs-eofblocks/ root 1400 0.0 0.0 0 0 ? S Feb19 0:52 [xfsaild/dm-0] root 1468 0.0 0.1 39076 2944 ? Ss Feb19 0:00 /usr/lib/system root 1493 0.0 0.2 127348 4132 ? Ss Feb19 0:00 /usr/sbin/lvmet root 1499 0.0 0.2 47416 4796 ? Ss Feb19 0:00 /usr/lib/system root 2294 0.0 0.0 0 0 ? S< Feb19 0:00 [xfs-buf/sda1] root 2300 0.0 0.0 0 0 ? S< Feb19 0:00 [xfs-data/sda1] root 2304 0.0 0.0 0 0 ? S< Feb19 0:00 [xfs-conv/sda1] root 2309 0.0 0.0 0 0 ? S< Feb19 0:00 [xfs-cil/sda1] root 2314 0.0 0.0 0 0 ? S< Feb19 0:00 [xfs-reclaim/sd root 2320 0.0 0.0 0 0 ? S< Feb19 0:00 [xfs-log/sda1] root 2326 0.0 0.0 0 0 ? S< Feb19 0:00 [xfs-eofblocks/ root 2332 0.0 0.0 0 0 ? S Feb19 0:00 [xfsaild/sda1] root 2680 0.0 0.0 62044 1084 ? S<sl Feb19 0:00 /sbin/auditd dbus 2718 0.0 0.1 66460 2656 ? Ssl Feb19 0:01 /usr/bin/dbus-d chrony 2720 0.0 0.0 117784 1816 ? S Feb19 0:00 /usr/sbin/chron polkitd 2727 0.0 0.7 612996 14024 ? Ssl Feb19 0:00 /usr/lib/polkit root 2729 0.0 0.0 26376 1800 ? Ss Feb19 0:00 /usr/lib/system root 2737 0.0 0.0 126316 1724 ? Ss Feb19 0:00 /usr/sbin/crond root 2768 0.0 0.0 110092 860 tty1 Ss+ Feb19 0:00 /sbin/agetty -- root 2772 0.0 1.7 362180 33428 ? Ssl Feb19 0:03 /usr/bin/python root 2774 0.0 0.4 473588 8460 ? Ssl Feb19 0:02 /usr/sbin/Netwo root 3254 0.0 0.9 573828 17092 ? Ssl Feb19 0:11 /usr/bin/python root 3255 0.0 0.2 112756 4348 ? Ss Feb19 0:00 /usr/sbin/sshd root 3257 0.0 0.2 222748 3896 ? Ssl Feb19 0:06 /usr/sbin/rsysl root 3301 0.0 0.0 115436 1752 ? S Feb19 0:00 /bin/sh /usr/lo root 3314 0.0 0.3 230472 5896 ? Ss Feb19 0:17 php-fpm: master php-fpm 3330 0.0 0.3 230472 6032 ? S Feb19 0:00 php-fpm: pool b php-fpm 3331 0.0 0.3 230472 6032 ? S Feb19 0:00 php-fpm: pool b mysql 3495 0.0 4.8 1255340 89712 ? Sl Feb19 0:39 /usr/local/mysq root 3794 0.0 0.1 89544 2164 ? Ss Feb19 0:00 /usr/libexec/po postfix 3796 0.0 0.2 89716 4096 ? S Feb19 0:00 qmgr -l -t unix root 5732 0.0 0.0 113308 696 ? S Feb19 0:00 /bin/sh /usr/lo root 5733 0.1 7.5 2542548 140564 ? Sl Feb19 1:58 /usr/bin/java - root 6320 0.0 0.0 0 0 ? S Feb19 0:00 [kworker/u2:2] root 6355 0.0 0.3 158744 5984 ? Ss Feb19 0:03 sshd: root@pts/ root 6360 0.0 0.1 115572 2200 pts/0 Ss Feb19 0:00 -bash root 6403 0.0 0.3 158744 5988 ? Ss Feb19 0:02 sshd: root@pts/ root 6407 0.0 0.1 115572 2224 pts/1 Ss Feb19 0:00 -bash root 6535 0.0 0.0 202492 1200 ? Ss Feb19 0:00 pure-ftpd (SERV root 6671 0.0 0.0 46452 1124 ? Ss Feb19 0:00 nginx: master p nginx 6672 0.0 0.1 46944 2308 ? S Feb19 0:00 nginx: worker p root 7545 0.9 0.1 21836 2000 pts/0 S+ 08:02 0:06 nload root 7546 0.0 0.0 0 0 ? R 08:03 0:00 [kworker/0:0] root 7592 0.0 0.0 0 0 ? S 08:06 0:00 [kworker/0:2] postfix 7594 0.0 0.2 89648 4064 ? S 08:08 0:00 pickup -l -t un root 7601 0.0 0.0 0 0 ? S 08:11 0:00 [kworker/0:1] root 7602 0.0 0.0 0 0 ? S 08:12 0:00 [kworker/0:3] root 7603 0.0 0.1 155360 1880 pts/1 R+ 08:14 0:00 ps aux
ls -l /proc/pid/ #查看一個進程的一些詳細信息
netstat -lnp 、netstat -lntp 、 netstat -lntup netstat -an ss -an
[root@feature1 ~]# 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:80 0.0.0.0:* LISTEN 6671/nginx: master tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 6535/pure-ftpd (SER tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3255/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3794/master tcp6 0 0 :::8009 :::* LISTEN 5733/java tcp6 0 0 :::3306 :::* LISTEN 3495/mysqld tcp6 0 0 :::8080 :::* LISTEN 5733/java tcp6 0 0 :::21 :::* LISTEN 6535/pure-ftpd (SER tcp6 0 0 :::22 :::* LISTEN 3255/sshd tcp6 0 0 ::1:25 :::* LISTEN 3794/master tcp6 0 0 127.0.0.1:8005 :::* LISTEN 5733/java udp 0 0 127.0.0.1:323 0.0.0.0:* 2720/chronyd udp6 0 0 ::1:323 :::* 2720/chronyd raw6 0 0 :::58 :::* 7 2774/NetworkManager Active UNIX domain sockets (only servers) Proto RefCnt Flags Type State I-Node PID/Program name Path unix 2 [ ACC ] STREAM LISTENING 7470 1/systemd /run/systemd/journal/stdout unix 2 [ ACC ] STREAM LISTENING 15167 1/systemd /run/lvm/lvmetad.socket unix 2 [ ACC ] STREAM LISTENING 25449 3794/master public/flush unix 2 [ ACC ] STREAM LISTENING 25431 3794/master private/tlsmgr unix 2 [ ACC ] STREAM LISTENING 25434 3794/master private/rewrite unix 2 [ ACC ] STREAM LISTENING 25437 3794/master private/bounce unix 2 [ ACC ] STREAM LISTENING 25427 3794/master public/qmgr unix 2 [ ACC ] STREAM LISTENING 25440 3794/master private/defer unix 2 [ ACC ] STREAM LISTENING 25443 3794/master private/trace unix 2 [ ACC ] STREAM LISTENING 25446 3794/master private/verify unix 2 [ ACC ] STREAM LISTENING 25452 3794/master private/proxymap unix 2 [ ACC ] STREAM LISTENING 25455 3794/master private/proxywrite unix 2 [ ACC ] STREAM LISTENING 25458 3794/master private/smtp unix 2 [ ACC ] STREAM LISTENING 25461 3794/master private/relay unix 2 [ ACC ] STREAM LISTENING 25467 3794/master private/error unix 2 [ ACC ] STREAM LISTENING 25470 3794/master private/retry unix 2 [ ACC ] STREAM LISTENING 14944 1/systemd /run/systemd/private unix 2 [ ACC ] STREAM LISTENING 25473 3794/master private/discard unix 2 [ ACC ] STREAM LISTENING 25476 3794/master private/local unix 2 [ ACC ] STREAM LISTENING 25479 3794/master private/virtual unix 2 [ ACC ] STREAM LISTENING 25482 3794/master private/lmtp unix 2 [ ACC ] STREAM LISTENING 24616 3314/php-fpm: maste /tmp/blog.socket unix 2 [ ACC ] STREAM LISTENING 25485 3794/master private/anvil unix 2 [ ACC ] STREAM LISTENING 25488 3794/master private/scache unix 2 [ ACC ] STREAM LISTENING 25182 3495/mysqld /tmp/mysql.sock unix 2 [ ACC ] STREAM LISTENING 25464 3794/master public/showq unix 2 [ ACC ] STREAM LISTENING 20594 1/systemd /run/dbus/system_bus_socket unix 2 [ ACC ] SEQPACKET LISTENING 14991 1/systemd /run/udev/control unix 2 [ ACC ] STREAM LISTENING 15274 1/systemd /run/lvm/lvmpolld.socket unix 2 [ ACC ] STREAM LISTENING 25420 3794/master public/pickup unix 2 [ ACC ] STREAM LISTENING 25424 3794/master public/cleanup
[root@feature1 ~]# ss -an Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port nl UNCONN 0 0 0:2774 * nl UNCONN 0 0 0:0 * nl UNCONN 0 0 0:2774 * nl UNCONN 4352 0 4:8263 * nl UNCONN 768 0 4:0 * nl UNCONN 0 0 6:0 * nl UNCONN 0 0 7:1 * nl UNCONN 0 0 7:2718 * nl UNCONN 0 0 7:0 * nl UNCONN 0 0 7:2718 * nl UNCONN 0 0 7:1 * nl UNCONN 0 0 9:1 * nl UNCONN 0 0 9:2680 * nl UNCONN 0 0 9:0 * nl UNCONN 0 0 10:0 * nl UNCONN 0 0 11:0 * nl UNCONN 0 0 12:0 * nl UNCONN 0 0 15:-4120 * nl UNCONN 0 0 15:1499 * nl UNCONN 0 0 15:-4107 * nl UNCONN 0 0 15:2729 * nl UNCONN 0 0 15:1 * nl UNCONN 0 0 15:2774 * nl UNCONN 0 0 15:-4117 * nl UNCONN 0 0 15:3254 * nl UNCONN 0 0 15:-4118 * nl UNCONN 0 0 15:0 * nl UNCONN 0 0 15:-4119 * nl UNCONN 0 0 15:3254 * nl UNCONN 0 0 15:-4120 * nl UNCONN 0 0 15:2774 * nl UNCONN 0 0 15:-4119 * nl UNCONN 0 0 15:-4118 * nl UNCONN 0 0 15:-4117 * nl UNCONN 0 0 15:2729 * nl UNCONN 0 0 15:-4107 * nl UNCONN 0 0 15:1 * nl UNCONN 0 0 16:0 * nl UNCONN 0 0 18:0 * p_dgr UNCONN 0 0 arp:enp0s3 * u_dgr UNCONN 0 0 /run/systemd/notify 7453 * 0 u_dgr UNCONN 0 0 /run/systemd/cgroups-agent 7455 * 0 u_str LISTEN 0 128 /run/systemd/journal/stdout 7470 * 0 u_dgr UNCONN 0 0 /run/systemd/journal/socket 7473 * 0 u_dgr UNCONN 0 0 /dev/log 7475 * 0 u_str LISTEN 0 128 /run/lvm/lvmetad.socket 15167 * 0 u_str LISTEN 0 100 public/flush 25449 * 0 u_str LISTEN 0 100 private/tlsmgr 25431 * 0 u_str LISTEN 0 100 private/rewrite 25434 * 0 u_str LISTEN 0 100 private/bounce 25437 * 0 u_str LISTEN 0 100 public/qmgr 25427 * 0 u_str LISTEN 0 100 private/defer 25440 * 0 u_str LISTEN 0 100 private/trace 25443 * 0 u_str LISTEN 0 100 private/verify 25446 * 0 u_str LISTEN 0 100 private/proxymap 25452 * 0 u_str LISTEN 0 100 private/proxywrite 25455 * 0 u_str LISTEN 0 100 private/smtp 25458 * 0 u_str LISTEN 0 100 private/relay 25461 * 0 u_str LISTEN 0 100 private/error 25467 * 0 u_str LISTEN 0 100 private/retry 25470 * 0 u_str LISTEN 0 128 /run/systemd/private 14944 * 0 u_str LISTEN 0 100 private/discard 25473 * 0 u_str LISTEN 0 100 private/local 25476 * 0 u_str LISTEN 0 100 private/virtual 25479 * 0 u_str LISTEN 0 100 private/lmtp 25482 * 0 u_str LISTEN 0 128 /tmp/blog.socket 24616 * 0 u_str LISTEN 0 100 private/anvil 25485 * 0 u_str LISTEN 0 100 private/scache 25488 * 0 u_str LISTEN 0 80 /tmp/mysql.sock 25182 * 0 u_str LISTEN 0 100 public/showq 25464 * 0 u_str LISTEN 0 128 /run/dbus/system_bus_socket 20594 * 0 u_seq LISTEN 0 128 /run/udev/control 14991 * 0 u_str LISTEN 0 128 /run/lvm/lvmpolld.socket 15274 * 0 u_str LISTEN 0 100 public/pickup 25420 * 0 u_str LISTEN 0 100 public/cleanup 25424 * 0 u_dgr UNCONN 0 0 /run/systemd/shutdownd 15334 * 0 u_dgr UNCONN 0 0 /var/run/chrony/chronyd.sock 20732 * 0 u_dgr UNCONN 0 0 * 24352 * 7475 u_str ESTAB 0 0 * 25418 * 25419 u_dgr UNCONN 0 0 * 53564 * 7475 u_str ESTAB 0 0 * 25419 * 25418 u_dgr UNCONN 0 0 * 25393 * 7475 u_str ESTAB 0 0 * 25421 * 25422 u_str ESTAB 0 0 * 30767 * 0 u_dgr UNCONN 0 0 * 20716 * 7475 u_str ESTAB 0 0 * 25460 * 25459 u_str ESTAB 0 0 * 15765 * 15766 u_str ESTAB 0 0 * 25490 * 25489 u_str ESTAB 0 0 * 25459 * 25460 u_str ESTAB 0 0 * 25489 * 25490 u_str ESTAB 0 0 * 21711 * 21712 u_str ESTAB 0 0 * 25457 * 25456 u_str ESTAB 0 0 * 20659 * 20660 u_str ESTAB 0 0 /run/systemd/journal/stdout 20660 * 20659 u_str ESTAB 0 0 * 25463 * 25462 u_str ESTAB 0 0 * 25425 * 25426 u_str ESTAB 0 0 /run/dbus/system_bus_socket 21712 * 21711 u_dgr UNCONN 0 0 * 41296 * 7473 u_str ESTAB 0 0 * 25462 * 25463 u_dgr UNCONN 0 0 * 15943 * 7473 u_dgr UNCONN 0 0 * 36532 * 7475 u_str ESTAB 0 0 /run/systemd/journal/stdout 15766 * 15765 u_dgr UNCONN 0 0 * 21785 * 7475 u_str ESTAB 0 0 * 37952 * 37953 u_dgr UNCONN 0 0 * 21113 * 7473 u_str ESTAB 0 0 * 25444 * 25445 u_str ESTAB 0 0 * 21347 * 21348 u_str ESTAB 0 0 /run/dbus/system_bus_socket 25209 * 25208 u_dgr UNCONN 0 0 * 25581 * 7475 u_str ESTAB 0 0 * 25442 * 25441 u_str ESTAB 0 0 * 25208 * 25209 u_str ESTAB 0 0 * 25441 * 25442 u_str ESTAB 0 0 /run/systemd/journal/stdout 21348 * 21347 u_str ESTAB 0 0 * 25422 * 25421 u_str ESTAB 0 0 * 25448 * 25447 u_dgr UNCONN 0 0 * 52316 * 7475 u_str ESTAB 0 0 * 25447 * 25448 u_str ESTAB 0 0 * 25445 * 25444 u_str ESTAB 0 0 /run/dbus/system_bus_socket 21140 * 21127 u_str ESTAB 0 0 * 21127 * 21140 u_str ESTAB 0 0 * 20755 * 20756 u_str ESTAB 0 0 * 30788 * 0 u_str ESTAB 0 0 * 25454 * 25453 u_str ESTAB 0 0 * 25478 * 25477 u_str ESTAB 0 0 /run/dbus/system_bus_socket 22453 * 22452 u_str ESTAB 0 0 * 25453 * 25454 u_str ESTAB 0 0 * 25477 * 25478 u_str ESTAB 0 0 * 37953 * 37952 u_str ESTAB 0 0 * 25456 * 25457 u_str ESTAB 0 0 * 20756 * 20755 u_str ESTAB 0 0 * 25475 * 25474 u_str ESTAB 0 0 * 25450 * 25451 u_str ESTAB 0 0 * 25474 * 25475 u_str ESTAB 0 0 * 24615 * 24614 u_str ESTAB 0 0 * 21372 * 21373 u_str ESTAB 0 0 * 25432 * 25433 u_str ESTAB 0 0 * 25472 * 25471 u_str ESTAB 0 0 * 24614 * 24615 u_str ESTAB 0 0 * 22452 * 22453 u_str ESTAB 0 0 * 25451 * 25450 u_str ESTAB 0 0 * 15922 * 15923 u_str ESTAB 0 0 * 25428 * 25429 u_dgr UNCONN 0 0 * 35561 * 7475 u_str ESTAB 0 0 * 21594 * 21595 u_str ESTAB 0 0 /run/systemd/journal/stdout 23918 * 23917 u_str ESTAB 0 0 /run/systemd/journal/stdout 24043 * 24042 u_str ESTAB 0 0 /run/dbus/system_bus_socket 21595 * 21594 u_dgr UNCONN 0 0 * 21686 * 7475 u_str ESTAB 0 0 * 25426 * 25425 u_str ESTAB 0 0 * 23917 * 23918 u_str ESTAB 0 0 /run/systemd/journal/stdout 15923 * 15922 u_dgr UNCONN 0 0 * 21379 * 7475 u_str ESTAB 0 0 /run/systemd/journal/stdout 21657 * 21656 u_str ESTAB 0 0 * 24042 * 24043 u_str ESTAB 0 0 * 20987 * 20988 u_dgr UNCONN 0 0 * 35146 * 7475 u_dgr UNCONN 0 0 * 21531 * 7475 u_str ESTAB 0 0 * 25469 * 25468 u_dgr UNCONN 0 0 * 20353 * 7475 u_str ESTAB 0 0 * 25433 * 25432 u_dgr UNCONN 0 0 * 16030 * 16029 u_str ESTAB 0 0 * 25468 * 25469 u_str ESTAB 0 0 * 20362 * 20363 u_str ESTAB 0 0 * 25484 * 25483 u_str ESTAB 0 0 * 25471 * 25472 u_str ESTAB 0 0 /run/dbus/system_bus_socket 21373 * 21372 u_str ESTAB 0 0 * 25487 * 25486 u_dgr UNCONN 0 0 * 16029 * 16030 u_str ESTAB 0 0 * 25486 * 25487 u_str ESTAB 0 0 * 25429 * 25428 u_str ESTAB 0 0 * 25435 * 25436 u_dgr UNCONN 0 0 * 15213 * 7453 u_str ESTAB 0 0 * 25466 * 25465 u_str ESTAB 0 0 * 21656 * 21657 u_str ESTAB 0 0 * 20363 * 20362 u_str ESTAB 0 0 * 25481 * 25480 u_str ESTAB 0 0 * 25436 * 25435 u_str ESTAB 0 0 /run/systemd/journal/stdout 20988 * 20987 u_str ESTAB 0 0 * 25465 * 25466 u_str ESTAB 0 0 * 25480 * 25481 u_str ESTAB 0 0 * 20615 * 20757 u_str ESTAB 0 0 * 25483 * 25484 u_str ESTAB 0 0 * 25438 * 25439 u_str ESTAB 0 0 /run/dbus/system_bus_socket 20757 * 20615 u_str ESTAB 0 0 * 25439 * 25438 raw UNCONN 0 0 :::58 :::* udp UNCONN 0 0 127.0.0.1:323 *:* udp UNCONN 0 0 ::1:323 :::* tcp LISTEN 0 128 *:80 *:* tcp LISTEN 0 9 *:21 *:* tcp LISTEN 0 128 *:22 *:* tcp LISTEN 0 100 127.0.0.1:25 *:* tcp ESTAB 0 0 10.0.2.20:22 10.0.2.2:52746 tcp ESTAB 0 0 10.0.2.20:22 10.0.2.2:55777 tcp ESTAB 0 0 10.0.2.20:22 10.0.2.2:52842 tcp LISTEN 0 100 :::8009 :::* tcp LISTEN 0 80 :::3306 :::* tcp LISTEN 0 100 :::8080 :::* tcp LISTEN 0 9 :::21 :::* tcp LISTEN 0 128 :::22 :::* tcp LISTEN 0 100 ::1:25 :::* tcp LISTEN 0 1 ::ffff:127.0.0.1:8005 :::*
tcpdump (安裝:yum install -y tcpdump) tcpdump -nn -i ens33 port 80 tcpdump -nn -i ens33 -c 100 -w 1.cap tcpdump -i ens33 -nn not port 22 and not port 80 and not host 192.168.222.1 tcpdump -nn -r 1.cap
[root@feature1 network-scripts]# tcpdump -nn -i enp0s3 port 80 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on enp0s3, link-type EN10MB (Ethernet), capture size 262144 bytes 13:57:27.294232 IP 10.0.2.20.33658 > 216.176.179.218.80: Flags [F.], seq 3577923689, ack 2188051152, win 32560, length 0 13:57:27.294534 IP 216.176.179.218.80 > 10.0.2.20.33658: Flags [R], seq 2188051152, win 0, length 0 13:57:33.565726 IP 10.0.2.20.33580 > 95.211.80.227.80: Flags [F.], seq 326927456, ack 2189460675, win 36712, length 0 13:57:33.566909 IP 95.211.80.227.80 > 10.0.2.20.33580: Flags [R], seq 2189460675, win 0, length 0
wireshark (安裝:yum install -y wireshark) tshark -i ens33 -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"
補充:api
查看cpu核數
cat /proc/cpuinfo lscpu buffer和cached
buffer : 這部份內存是從CPU產生即將寫入到磁盤裏去的那部分數據;
cached 這部分數據是先從磁盤裏讀出來,然 後臨時存到內存裏的那部分數據, 小常識:
bit 比特(帶寬單位) Byte 字節 (速度傳輸單位) 8bit = 1Byte 2MB/s 2*8=16Mbit 100Mbit 12.8MB/s