w命令:查看cpu負載狀況mysql
[root@lgs-01 ~]# w 11:20:20 up 1 min, 1 user, load average: 0.27, 0.18, 0.07 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root pts/0 192.168.87.1 11:20 3.00s 0.09s 0.01s w
關注第一行,load average:表明每1分鐘、每5分鐘、每10分鐘時間段內使用cpu的活動進程個數的平均值。linux
通常與cpu邏輯內核數進行比較,在/proc/cpuinfo 內查看cpu內核數(processor的值),如3爲4核。ios
負載值不大於cpu內核數 便可。意思是cpu可以處理進程的請求,不用排隊等待。通常多關注1分鐘的平均值。git
第一行下面的是用戶登陸信息,TTY列:pts爲網絡登陸,tty爲本地登陸。IDEL爲cpu空閒時間。sql
w命令的第一行與uptime命令輸出結果同樣。bash
[root@lgs-01 ~]# w 11:27:17 up 8 min, 1 user, load average: 0.00, 0.05, 0.05 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root pts/0 192.168.87.1 11:20 5.00s 0.10s 0.01s w [root@lgs-01 ~]# uptime 11:27:19 up 8 min, 1 user, load average: 0.00, 0.05, 0.05
vmstat命令:查看進程、內存、swap、IO、cpu等系統資源的整體狀況,一幫可以判斷系統瓶頸在哪裏網絡
vmstat 1:表示1秒鐘顯示一次,用ctrl+C結束架構
[root@lgs-01 ~]# 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 1 0 0 1079396 2076 204700 0 0 130 9 104 109 0 1 99 0 0 0 0 0 1079380 2076 204732 0 0 0 0 108 100 0 0 100 0 0 0 0 0 1079380 2076 204732 0 0 0 0 89 83 0 0 100 0 0 0 0 0 1079380 2076 204732 0 0 0 0 105 97 0 0 100 0 0 0 0 0 1079380 2076 204732 0 0 0 0 87 81 0 0 100 0 0 0 0 0 1079380 2076 204732 0 0 0 25 133 116 0 1 99 0 0 0 0 0 1079380 2076 204732 0 0 0 0 134 128 0 0 100 0 0 0 0 0 1079380 2076 204732 0 0 0 0 158 136 0 0 100 0 0 ^C
vmstat 1 8:表示1秒顯示一次,顯示8次後自動結束ssh
[root@lgs-01 ~]# vmstat 1 8 procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 1 0 0 1079396 2076 204732 0 0 122 9 101 106 0 1 99 0 0 0 0 0 1079380 2076 204732 0 0 0 0 98 93 0 0 100 0 0 0 0 0 1079380 2076 204732 0 0 0 0 119 100 0 1 99 0 0 0 0 0 1079380 2076 204732 0 0 0 0 93 88 0 0 100 0 0 0 0 0 1079380 2076 204732 0 0 0 0 92 81 0 0 100 0 0 0 0 0 1079380 2076 204732 0 0 0 0 113 103 0 0 100 0 0 0 0 0 1079380 2076 204732 0 0 0 0 103 91 0 0 100 0 0 0 0 0 1079380 2076 204732 0 0 0 0 90 88 0 0 100 0 0 [root@lgs-01 ~]#
重點關注的信息: r:run,處於run狀態的進程數(正在使用cpu、或者在排隊等待cpu資源的都算run狀態)ide
b:block,被cpu之外的資源堵住的進程的數量(如網絡、IO、磁盤等),即在等待其餘資源處理的狀態
swpd:數值不斷變化一會多一會少就要重點關注內存是否不夠了,說明swap區與內存在頻繁交換數據。
si:多少kb數據進入內存中(從swap區),之內存爲參照物
so:多少kb數據從內存出來進入swap區,之內存爲參照物
bi:從磁盤出來 到內存的數據量。 讀
bo:從內存寫入到磁盤的數據量。寫
us:用戶級別的服務、進程佔用cpu的百分比,長期大於50表示系統資源比較緊張
sy:系統級別的服務、進程佔用cpu百分比。
id:idel 空閒的cpu資源百分比。
us+sy+id=100
wa:wait 與b相似,等待cpu的進程百分比。數值大表示cpu資源不夠分配用。
top命令:查看具體進程使用系統資源(cpu、內存等)的狀況,3秒動態刷新顯示一次
[root@lgs-01 ~]# top top - 11:47:44 up 29 min, 1 user, load average: 0.00, 0.01, 0.05 Tasks: 98 total, 2 running, 96 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1867048 total, 1078588 free, 581368 used, 207092 buff/cache KiB Swap: 4194300 total, 4194300 free, 0 used. 1099564 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1 root 20 0 128164 6828 4064 S 0.0 0.4 0:01.06 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.02 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:00.24 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:00.11 kworker/u256:0 7 root rt 0 0 0 0 S 0.0 0.0 0:00.06 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.67 rcu_sched 10 root rt 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0 11 root rt 0 0 0 0 S 0.0 0.0 0:00.01 watchdog/1 12 root rt 0 0 0 0 S 0.0 0.0 0:00.01 migration/1 13 root 20 0 0 0 0 S 0.0 0.0 0:00.07 ksoftirqd/1 15 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/1:0H
runing:運行狀態的進程數
sleeping:在休息等會在運行的進程數
zombie:殭屍進程數,主進程意外死掉了,留下子進程沒人管就變成殭屍進程了。
%cpu(s):us+sy+id=100% 。 st:被偷走的cpu,如虛擬化的子機器。
關注us用戶服務,60%以上都要當心。
這裏的cpu資源使用百分比與w命令中的cpu負載不一樣概念。
通常us大,負載確定大。反過來則不必定。
top 默認按%cpu排序,由高到低。
按M:按%Mem排序。
按P:按%cpu排序。
按1:%cpu(s) 變成%cpu0,表示單獨查看某個內核的使用狀況
按q:退出。
top -c:看進程運行的具體全局命令。
[root@lgs-01 ~]# top -c top - 11:56:23 up 37 min, 1 user, load average: 0.00, 0.01, 0.05 Tasks: 97 total, 1 running, 96 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1867048 total, 1078540 free, 581352 used, 207156 buff/cache KiB Swap: 4194300 total, 4194300 free, 0 used. 1099548 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 9 root 20 0 0 0 0 S 0.3 0.0 0:01.90 [rcu_sched] 1 root 20 0 128164 6828 4064 S 0.0 0.4 0:01.06 /usr/lib/systemd/systemd --switched-root --system --deserialize 21 2 root 20 0 0 0 0 S 0.0 0.0 0:00.02 [kthreadd] 3 root 20 0 0 0 0 S 0.0 0.0 0:00.24 [ksoftirqd/0] 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kworker/0:0H
top -bn1:靜態顯示所有進程信息,在腳本中經常使用。
[root@lgs-01 ~]# top -bn1 top - 11:57:15 up 38 min, 1 user, load average: 0.00, 0.01, 0.05 Tasks: 97 total, 2 running, 95 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1867048 total, 1078788 free, 581104 used, 207156 buff/cache KiB Swap: 4194300 total, 4194300 free, 0 used. 1099796 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1 root 20 0 128164 6828 4064 S 0.0 0.4 0:01.06 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.02 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:00.24 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:00.13 kworker/u256:0 7 root rt 0 0 0 0 S 0.0 0.0 0:00.08 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 R 0.0 0.0 0:01.92 rcu_sched 10 root rt 0 0 0 0 S 0.0 0.0 0:00.01 watchdog/0 11 root rt 0 0 0 0 S 0.0 0.0 0:00.01 watchdog/1 12 root rt 0 0 0 0 S 0.0 0.0 0:00.01 migration/1 13 root 20 0 0 0 0 S 0.0 0.0 0:00.09 ksoftirqd/1 15 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/1:0H 17 root 20 0 0 0 0 S 0.0 0.0 0:00.13 kdevtmpfs 18 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns 19 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khungtaskd 20 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 writeback 21 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kintegrityd 22 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset 23 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kblockd 24 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 md 25 root 20 0 0 0 0 S 0.0 0.0 0:02.61 kworker/0:1 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.39 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 kpsmoused 46 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ipv6_addrconf 66 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 deferwq 98 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kauditd 237 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ata_sff 238 root 20 0 0 0 0 S 0.0 0.0 0:00.01 scsi_eh_0 239 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 scsi_tmf_0 240 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_1 241 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 scsi_tmf_1 243 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 mpt_poll_0 244 root 20 0 0 0 0 S 0.0 0.0 0:00.03 kworker/u256:3 245 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 mpt/0 253 root 20 0 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_2 254 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 scsi_tmf_2 256 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ttm_swap 286 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset 287 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfsalloc 288 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs_mru_cache 289 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-buf/sda3 290 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-data/sda3 291 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-conv/sda3 292 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-cil/sda3 293 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-reclaim/sda 294 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-log/sda3 295 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-eofblocks/s 296 root 20 0 0 0 0 S 0.0 0.0 0:00.20 xfsaild/sda3 364 root 20 0 36832 2804 2488 S 0.0 0.2 0:00.19 systemd-journal 382 root 20 0 342552 5520 2600 S 0.0 0.3 0:00.00 lvmetad 384 root 20 0 48004 5956 2816 S 0.0 0.3 0:00.43 systemd-udevd 410 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 nfit 495 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-buf/sda1 496 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-data/sda1 497 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-conv/sda1 498 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-cil/sda1 499 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-reclaim/sda 500 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-log/sda1 501 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 xfs-eofblocks/s 503 root 20 0 0 0 0 S 0.0 0.0 0:00.00 xfsaild/sda1 506 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kdmflush 507 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset 534 root 16 -4 55452 892 484 S 0.0 0.0 0:00.00 auditd 557 polkitd 20 0 535088 11128 4876 S 0.0 0.6 0:00.38 polkitd 558 root 20 0 99760 6208 4484 S 0.0 0.3 0:00.35 VGAuthService 559 root 20 0 281924 8148 3340 S 0.0 0.4 0:00.37 rsyslogd 566 root 20 0 305296 6312 4932 S 0.0 0.3 0:03.58 vmtoolsd 568 root 20 0 21620 1284 976 S 0.0 0.1 0:01.12 irqbalance 569 root 20 0 24204 1668 1372 S 0.0 0.1 0:00.07 systemd-logind 570 dbus 20 0 32768 1836 1412 S 0.0 0.1 0:00.36 dbus-daemon 574 chrony 20 0 115640 1776 1312 S 0.0 0.1 0:01.05 chronyd 585 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/1:1H 591 root 20 0 126232 1644 1024 S 0.0 0.1 0:00.41 crond 609 root 20 0 334236 28980 6888 S 0.0 1.6 0:01.14 firewalld 611 root 20 0 472116 9032 6768 S 0.0 0.5 0:00.29 NetworkManager 667 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:1H 916 root 20 0 105996 4076 3100 S 0.0 0.2 0:00.03 sshd 917 root 20 0 562392 18620 5904 S 0.0 1.0 0:00.67 tuned 956 root 20 0 115388 1700 1392 S 0.0 0.1 0:00.02 mysqld_safe 1193 mysql 20 0 1300776 452356 5856 S 0.0 24.2 0:06.51 mysqld 1257 root 20 0 89544 2088 1072 S 0.0 0.1 0:00.17 master 1258 postfix 20 0 89648 4000 2996 S 0.0 0.2 0:00.12 pickup 1259 postfix 20 0 89716 4032 3020 S 0.0 0.2 0:00.01 qmgr 1271 root 20 0 110044 820 696 S 0.0 0.0 0:00.01 agetty 1376 root 20 0 147844 5376 4072 S 0.0 0.3 0:00.84 sshd 1379 root 20 0 115524 2156 1664 S 0.0 0.1 0:00.15 bash 1408 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kworker/1:2 1413 root 20 0 0 0 0 S 0.0 0.0 0:00.18 kworker/1:0 1414 root 20 0 0 0 0 S 0.0 0.0 0:00.02 kworker/0:2 1415 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kworker/0:0 1417 root 20 0 157584 2016 1472 R 0.0 0.1 0:00.00 top
RES列:表示已用的內存數,單位kb
PID:進程id,可使用kill pdi殺死進程。
1418 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/1:1 1419 root 20 0 157684 2144 1508 T 0.0 0.1 0:00.01 top 1420 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kworker/0:2 [root@lgs-01 ~]# kill 1419
sar命令:監控系統的狀態,用來查看網卡流量比較多。
sar:被稱爲linux系統的瑞士軍刀,功能豐富,安裝sysstat包才能使用該命令。
[root@lgs-01 ~]# sar -bash: sar: 未找到命令 [root@lgs-01 ~]# yum install -y sysstat 已加載插件:fastestmirror Determining fastest mirrors 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 sysstat.x86_64.0.10.1.5-12.el7 將被 安裝 --> 正在處理依賴關係 libsensors.so.4()(64bit),它被軟件包 sysstat-10.1.5-12.el7.x86_64 須要 --> 正在檢查事務 ---> 軟件包 lm_sensors-libs.x86_64.0.3.4.0-4.20160601gitf9185e5.el7 將被 安裝 --> 解決依賴關係完成 依賴關係解決 =================================================================================================================================================== Package 架構 版本 源 大小 =================================================================================================================================================== 正在安裝: sysstat x86_64 10.1.5-12.el7 base 310 k 爲依賴而安裝: lm_sensors-libs x86_64 3.4.0-4.20160601gitf9185e5.el7 base 41 k 事務概要 =================================================================================================================================================== 安裝 1 軟件包 (+1 依賴軟件包) 總下載量:351 k 安裝大小:1.2 M Downloading packages: (1/2): lm_sensors-libs-3.4.0-4.20160601gitf9185e5.el7.x86_64.rpm | 41 kB 00:00:00 (2/2): sysstat-10.1.5-12.el7.x86_64.rpm | 310 kB 00:00:00 --------------------------------------------------------------------------------------------------------------------------------------------------- 總計 437 kB/s | 351 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安裝 : lm_sensors-libs-3.4.0-4.20160601gitf9185e5.el7.x86_64 1/2 正在安裝 : sysstat-10.1.5-12.el7.x86_64 2/2 驗證中 : sysstat-10.1.5-12.el7.x86_64 1/2 驗證中 : lm_sensors-libs-3.4.0-4.20160601gitf9185e5.el7.x86_64 2/2 已安裝: sysstat.x86_64 0:10.1.5-12.el7 做爲依賴被安裝: lm_sensors-libs.x86_64 0:3.4.0-4.20160601gitf9185e5.el7 完畢!
sar命令:剛安裝好,不加參數運行報錯,由於不加參數會調用系統保留的sar歷史文件。
[root@lgs-01 ~]# sar 沒法打開 /var/log/sa/sa06: 沒有那個文件或目錄 [root@lgs-01 ~]# ls -l /var/log/sa/ 總用量 0
這個文件是每隔10分鐘纔會生成的。
sar -n DEV 1 8:查看網卡流量
[root@lgs-01 ~]# sar -n DEV 1 8 Linux 3.10.0-693.el7.x86_64 (lgs-01) 2018年05月06日 _x86_64_ (2 CPU) 12時09分08秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 12時09分09秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 12時09分09秒 ens33 0.00 0.00 0.00 0.00 0.00 0.00 0.00 12時09分09秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 12時09分10秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 12時09分10秒 ens33 1.00 1.00 0.06 0.40 0.00 0.00 0.00 12時09分10秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 12時09分11秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 12時09分11秒 ens33 3.00 1.00 0.18 0.40 0.00 0.00 0.00 12時09分11秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 12時09分12秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 12時09分12秒 ens33 2.00 1.00 0.12 0.40 0.00 0.00 0.00 12時09分12秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 12時09分13秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 12時09分13秒 ens33 1.00 1.00 0.06 0.40 0.00 0.00 0.00 12時09分13秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 12時09分14秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 12時09分14秒 ens33 3.96 1.98 0.31 0.45 0.00 0.00 0.00 12時09分14秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 12時09分15秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 12時09分15秒 ens33 2.00 1.00 0.12 0.40 0.00 0.00 0.00 12時09分15秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 12時09分16秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 12時09分16秒 ens33 2.00 2.00 0.19 0.46 0.00 0.00 0.00 平均時間: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 平均時間: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 平均時間: ens33 1.87 1.12 0.13 0.36 0.00 0.00 0.00 [root@lgs-01 ~]#
通常關注:rx pck/s 、tx pck/s、rx kb/s、tx kb/s
rx pck/s:接收數據包個數, 1秒多少個。通常幾千個算正常,上萬就要當心爲何了,可能被攻擊了。
tx pck/s:發生數據包個數,1秒多少個
rx kb/s:接收數據量,1秒幾kb
tx kb/s:發送數據量,1秒幾kb
若是接收數據包不少,網絡會堵塞,網站就不能正常訪問。
帶寬跑滿也是很危險的(每秒的數據量很大)
rxcmp/s txcmp/s rxmcst/s:壓縮數據包、多播數據包。這三個不用關注,通常都是0.00
sar -q 1 5:系統負載,與w同樣
[root@lgs-01 ~]# sar -q 1 5 Linux 3.10.0-693.el7.x86_64 (lgs-01) 2018年05月06日 _x86_64_ (2 CPU) 12時19分02秒 runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 12時19分03秒 1 136 0.00 0.01 0.05 0 12時19分04秒 0 136 0.00 0.01 0.05 0 12時19分05秒 1 136 0.00 0.01 0.05 0 12時19分06秒 1 136 0.00 0.01 0.05 0 12時19分07秒 0 136 0.00 0.01 0.05 0 平均時間: 1 136 0.00 0.01 0.05 0
sar -b 1 5:查看磁盤的讀寫狀況
[root@lgs-01 ~]# sar -b 1 5 Linux 3.10.0-693.el7.x86_64 (lgs-01) 2018年05月06日 _x86_64_ (2 CPU) 12時19分46秒 tps rtps wtps bread/s bwrtn/s 12時19分47秒 0.00 0.00 0.00 0.00 0.00 12時19分48秒 0.00 0.00 0.00 0.00 0.00 12時19分49秒 0.00 0.00 0.00 0.00 0.00 12時19分50秒 0.00 0.00 0.00 0.00 0.00 12時19分51秒 0.00 0.00 0.00 0.00 0.00 平均時間: 0.00 0.00 0.00 0.00 0.00
/var/log/sa/sa06 :二進制文件,不能cat查看。
/var/log/sa/sar06: 能夠用cat查看內容。
nload命令:查看網卡流量,動態顯示
[root@lgs-01 ~]# nload Device ens33 [192.168.87.130] (1/2): =================================================================================================================================================== Incoming: Curr: 936.00 Bit/s Avg: 1.22 kBit/s Min: 936.00 Bit/s Max: 1.99 kBit/s Ttl: 19.17 MByte Outgoing: Curr: 8.99 kBit/s Avg: 8.97 kBit/s Min: 4.26 kBit/s Max: 9.52 kBit/s Ttl: 1.79 MByte
按 ->:查看第二個網卡
Device lo [127.0.0.1] (2/2): =================================================================================================================================================== Incoming: Curr: 0.00 Bit/s Avg: 0.00 Bit/s Min: 0.00 Bit/s Max: 0.00 Bit/s Ttl: 6.09 kByte Outgoing: Curr: 0.00 Bit/s Avg: 0.00 Bit/s Min: 0.00 Bit/s Max: 0.00 Bit/s Ttl: 6.09 kByte
按q:退出。
通常看出去的帶寬,一直處於滿的狀態就要警戒
若是進來的流量很大,就要查看是否有攻擊了。