幾個常用的linux效能監控命令
1. sar
每兩秒重新整理一次, 總共5次
[root@dbhost01 ~]# sar 2 5
Linux 2.6.32-504.el6.x86_64 (dbhost01) 03/30/2018 _x86_64_ (4 CPU)
02:53:15 PM CPU %user %nice %system %iowait %steal %idle
02:53:17 PM all 0.66 0.00 1.72 0.66 0.00 96.96
02:53:19 PM all 1.34 0.00 3.35 0.80 0.00 94.51
02:53:21 PM all 0.79 0.00 1.59 1.45 0.00 96.17
02:53:23 PM all 0.40 0.00 2.00 0.80 0.00 96.80
02:53:25 PM all 0.66 0.00 1.85 0.79 0.00 96.70
Average: all 0.77 0.00 2.10 0.90 0.00 96.23
2. top
top -a 按照記憶體降序
[root@dbhost01 ~]# top -a
top - 15:00:54 up 6:04, 1 user, load average: 0.31, 0.19, 0.11
Tasks: 306 total, 1 running, 305 sleeping, 0 stopped, 0 zombie
Cpu(s): 7.8%us, 2.4%sy, 0.0%ni, 88.9%id, 0.8%wa, 0.0%hi, 0.1%si, 0.0%st
Mem: 4048972k total, 3848576k used, 200396k free, 134844k buffers
Swap: 4194300k total, 1788k used, 4192512k free, 1835360k cached
3. vmstat
vmstat用於顯示虛擬記憶體,核心執行緒,磁碟,系統程式, CPU活動等統計資訊。
需要安裝sysstat工具。
[root@dbhost01 ~]# vmstat
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 1788 202508 135064 1835920 0 0 32 26 96 276 1 2 95 1 0
[root@dbhost01 ~]#
[root@dbhost01 ~]# vmstat 2 5
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 1788 202336 135068 1836000 0 0 32 26 97 276 1 2 95 1 0
0 0 1788 202624 135068 1836000 0 0 25 29 4012 6682 0 1 98 1 0
0 0 1788 202624 135072 1836004 0 0 57 87 4003 6685 0 1 98 1 0
1 0 1788 202508 135072 1836004 0 0 57 33 4402 7353 1 1 98 0 0
0 0 1788 202540 135076 1836004 0 0 33 47 4002 6674 0 1 98 1 0
4. lsof(list open files)
[root@dbhost01 ~]# lsof | grep 1521
certmonge 2348 root 16r FIFO 0,8 0t0 15212 pipe
certmonge 2348 root 18r FIFO 0,8 0t0 15218 pipe
gipcd.bin 2754 grid 109u unix 0xffff880139152180 0t0 36936 socket
5. tcpdump
tcpdump -i eth1
15:24:28.777779 IP dbhost01.ssh > 192.168.2.82.50990: Flags [P.], seq 393080:393596, ack 105, win 148, options [nop,nop,TS val 22996360 ecr 2443327], length 516
15:24:28.777809 IP dbhost01.ssh > 192.168.2.82.50990: Flags [P.], seq 393080:393596, ack 105, win 148, options [nop,nop,TS val 22996360 ecr 2443327], length 516
15:24:28.778976 IP dbhost01.ssh > 192.168.2.82.50990: Flags [P.], seq 393596:393968, ack 105, win 148, options [nop,nop,TS val 22996361 ecr 2443327], length 372
15:24:28.779011 IP dbhost01.ssh > 192.168.2.82.50990: Flags [P.], seq 393596:393968, ack 105, win 148, options [nop,nop,TS val 22996361 ecr 2443327], length 372
15:24:28.779013 IP 192.168.2.82.50990 > dbhost01.ssh: Flags [.], ack 393968, win 16652, options [nop,nop,TS val 2443327 ecr 22996360], length 0
15:24:28.779481 IP dbhost02-priv.23602 > dbhost01-priv.24271: UDP, length 556
15:24:28.779585 IP dbhost01-priv.24271 > dbhost02-priv.23602: UDP, length 80
15:24:28.779909 IP dbhost01-priv.24271 > dbhost02-priv.23602: UDP, length 80
15:24:28.780584 IP dbhost01.ssh > 192.168.2.82.50990: Flags [P.], seq 393968:394724, ack 105, win 148, options [nop,nop,TS val 22996362 ecr 2443327], length 756
15:24:28.780590 IP dbhost01.ssh > 192.168.2.82.50990: Flags [P.], seq 393968:394724, ack 105, win 148, options [nop,nop,TS val 22996362 ecr 2443327], length 756
15:24:28.780820 IP dbhost01-priv.24271 > dbhost02-priv.23602: UDP, length 556
15:24:28.782232 IP dbhost01.ssh > 192.168.2.82.50990: Flags [P.], seq 394724:395176, ack 105, win 148, options [nop,nop,TS val 22996364 ecr 2443327], length 452
15:24:28.782235 IP dbhost01.ssh > 192.168.2.82.50990: Flags [P.], seq 394724:395176, ack 105, win 148, options [nop,nop,TS val 22996364 ecr 2443327], length 452
6.netstat
[root@dbhost01 ~]# netstat -a | grep oracle
unix 2 [ ACC ] STREAM LISTENING 31861 /var/tmp/.oracle/ora_gipc_sdbhost01gridmyracdb-clusterCRFM_SIPC
unix 2 [ ACC ] STREAM LISTENING 33820 /var/tmp/.oracle/sdbhost01DBG_LOGD
unix 2 [ ACC ] STREAM LISTENING 41177 /var/tmp/.oracle/sdbhost01DBG_EVMD
unix 2 [ ACC ] STREAM LISTENING 65106 /var/tmp/.oracle/sAevm
unix 2 [ ACC ] STREAM LISTENING 65108 /var/tmp/.oracle/sSYSTEM.evm.acceptor.auth
7. htop
需要安裝
8. iostat
Total DISK READ: 91.48 K/s | Total DISK WRITE: 45.27 K/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
4071 be/4 oracle 30.18 K/s 0.00 B/s 0.00 % 4.69 % ora_lmon_orcl1
4117 be/4 oracle 60.36 K/s 15.09 K/s 0.00 % 3.69 % ora_ckpt_orcl1
2989 rt/4 grid 965.71 B/s 0.00 B/s 0.00 % 2.13 % ocssd.bin
4099 be/4 oracle 0.00 B/s 30.18 K/s 0.00 % 0.07 % ora_ckpt_test
2987 rt/4 grid 0.00 B/s 482.86 B/s 0.00 % 0.03 % ocssd.bin
2979 rt/3 root 0.00 B/s 3.77 K/s 0.00 % 0.00 % ologgerd -M -d /g01/grid/app/11.2.0/grid/crf/db/dbhost01
2980 rt/3 root 0.00 B/s 15.09 K/s 0.00 % 0.00 % ologgerd -M -d /g01/grid/app/11.2.0/grid/crf/db/dbhost01
9. iftop(流量監控工具)
參考:
每兩秒重新整理一次, 總共5次
[root@dbhost01 ~]# sar 2 5
Linux 2.6.32-504.el6.x86_64 (dbhost01) 03/30/2018 _x86_64_ (4 CPU)
02:53:15 PM CPU %user %nice %system %iowait %steal %idle
02:53:17 PM all 0.66 0.00 1.72 0.66 0.00 96.96
02:53:19 PM all 1.34 0.00 3.35 0.80 0.00 94.51
02:53:21 PM all 0.79 0.00 1.59 1.45 0.00 96.17
02:53:23 PM all 0.40 0.00 2.00 0.80 0.00 96.80
02:53:25 PM all 0.66 0.00 1.85 0.79 0.00 96.70
Average: all 0.77 0.00 2.10 0.90 0.00 96.23
2. top
top -a 按照記憶體降序
[root@dbhost01 ~]# top -a
top - 15:00:54 up 6:04, 1 user, load average: 0.31, 0.19, 0.11
Tasks: 306 total, 1 running, 305 sleeping, 0 stopped, 0 zombie
Cpu(s): 7.8%us, 2.4%sy, 0.0%ni, 88.9%id, 0.8%wa, 0.0%hi, 0.1%si, 0.0%st
Mem: 4048972k total, 3848576k used, 200396k free, 134844k buffers
Swap: 4194300k total, 1788k used, 4192512k free, 1835360k cached
3. vmstat
vmstat用於顯示虛擬記憶體,核心執行緒,磁碟,系統程式, CPU活動等統計資訊。
需要安裝sysstat工具。
[root@dbhost01 ~]# vmstat
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 1788 202508 135064 1835920 0 0 32 26 96 276 1 2 95 1 0
[root@dbhost01 ~]#
[root@dbhost01 ~]# vmstat 2 5
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 1788 202336 135068 1836000 0 0 32 26 97 276 1 2 95 1 0
0 0 1788 202624 135068 1836000 0 0 25 29 4012 6682 0 1 98 1 0
0 0 1788 202624 135072 1836004 0 0 57 87 4003 6685 0 1 98 1 0
1 0 1788 202508 135072 1836004 0 0 57 33 4402 7353 1 1 98 0 0
0 0 1788 202540 135076 1836004 0 0 33 47 4002 6674 0 1 98 1 0
4. lsof(list open files)
[root@dbhost01 ~]# lsof | grep 1521
certmonge 2348 root 16r FIFO 0,8 0t0 15212 pipe
certmonge 2348 root 18r FIFO 0,8 0t0 15218 pipe
gipcd.bin 2754 grid 109u unix 0xffff880139152180 0t0 36936 socket
5. tcpdump
tcpdump -i eth1
15:24:28.777779 IP dbhost01.ssh > 192.168.2.82.50990: Flags [P.], seq 393080:393596, ack 105, win 148, options [nop,nop,TS val 22996360 ecr 2443327], length 516
15:24:28.777809 IP dbhost01.ssh > 192.168.2.82.50990: Flags [P.], seq 393080:393596, ack 105, win 148, options [nop,nop,TS val 22996360 ecr 2443327], length 516
15:24:28.778976 IP dbhost01.ssh > 192.168.2.82.50990: Flags [P.], seq 393596:393968, ack 105, win 148, options [nop,nop,TS val 22996361 ecr 2443327], length 372
15:24:28.779011 IP dbhost01.ssh > 192.168.2.82.50990: Flags [P.], seq 393596:393968, ack 105, win 148, options [nop,nop,TS val 22996361 ecr 2443327], length 372
15:24:28.779013 IP 192.168.2.82.50990 > dbhost01.ssh: Flags [.], ack 393968, win 16652, options [nop,nop,TS val 2443327 ecr 22996360], length 0
15:24:28.779481 IP dbhost02-priv.23602 > dbhost01-priv.24271: UDP, length 556
15:24:28.779585 IP dbhost01-priv.24271 > dbhost02-priv.23602: UDP, length 80
15:24:28.779909 IP dbhost01-priv.24271 > dbhost02-priv.23602: UDP, length 80
15:24:28.780584 IP dbhost01.ssh > 192.168.2.82.50990: Flags [P.], seq 393968:394724, ack 105, win 148, options [nop,nop,TS val 22996362 ecr 2443327], length 756
15:24:28.780590 IP dbhost01.ssh > 192.168.2.82.50990: Flags [P.], seq 393968:394724, ack 105, win 148, options [nop,nop,TS val 22996362 ecr 2443327], length 756
15:24:28.780820 IP dbhost01-priv.24271 > dbhost02-priv.23602: UDP, length 556
15:24:28.782232 IP dbhost01.ssh > 192.168.2.82.50990: Flags [P.], seq 394724:395176, ack 105, win 148, options [nop,nop,TS val 22996364 ecr 2443327], length 452
15:24:28.782235 IP dbhost01.ssh > 192.168.2.82.50990: Flags [P.], seq 394724:395176, ack 105, win 148, options [nop,nop,TS val 22996364 ecr 2443327], length 452
6.netstat
[root@dbhost01 ~]# netstat -a | grep oracle
unix 2 [ ACC ] STREAM LISTENING 31861 /var/tmp/.oracle/ora_gipc_sdbhost01gridmyracdb-clusterCRFM_SIPC
unix 2 [ ACC ] STREAM LISTENING 33820 /var/tmp/.oracle/sdbhost01DBG_LOGD
unix 2 [ ACC ] STREAM LISTENING 41177 /var/tmp/.oracle/sdbhost01DBG_EVMD
unix 2 [ ACC ] STREAM LISTENING 65106 /var/tmp/.oracle/sAevm
unix 2 [ ACC ] STREAM LISTENING 65108 /var/tmp/.oracle/sSYSTEM.evm.acceptor.auth
7. htop
需要安裝
8. iostat
Total DISK READ: 91.48 K/s | Total DISK WRITE: 45.27 K/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
4071 be/4 oracle 30.18 K/s 0.00 B/s 0.00 % 4.69 % ora_lmon_orcl1
4117 be/4 oracle 60.36 K/s 15.09 K/s 0.00 % 3.69 % ora_ckpt_orcl1
2989 rt/4 grid 965.71 B/s 0.00 B/s 0.00 % 2.13 % ocssd.bin
4099 be/4 oracle 0.00 B/s 30.18 K/s 0.00 % 0.07 % ora_ckpt_test
2987 rt/4 grid 0.00 B/s 482.86 B/s 0.00 % 0.03 % ocssd.bin
2979 rt/3 root 0.00 B/s 3.77 K/s 0.00 % 0.00 % ologgerd -M -d /g01/grid/app/11.2.0/grid/crf/db/dbhost01
2980 rt/3 root 0.00 B/s 15.09 K/s 0.00 % 0.00 % ologgerd -M -d /g01/grid/app/11.2.0/grid/crf/db/dbhost01
9. iftop(流量監控工具)
參考:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26870952/viewspace-2152872/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux中監控系統效能常用的命令!Linux
- 常用的4個伺服器效能監控命令伺服器
- 監控 Linux 伺服器活動的幾個命令Linux伺服器
- 進行Linux效能監控的命令介紹Linux
- Linux伺服器效能追蹤以及伺服器監控常用命令Linux伺服器
- Linux常用效能命令Linux
- Linux 效能監控工具Linux
- Linux常用命令:效能命令Linux
- Linux常用的監控軟體介紹!Linux
- Linux程式管理與效能監控Linux
- 10多個 Linux 系統管理員必備的監控工具、常用的網站監控工具Linux網站
- linux伺服器檢視監控頻寬的幾個工具Linux伺服器
- ☕[JVM效能專題](1)效能監控-命令列工具JVM命令列
- Redis 常用監控資訊命令總結Redis
- DBA常用系統監控命令(之一)
- 常用的Linux,記住了幾個?Linux
- 在Linux中,如何監控系統的效能?Linux
- Linux中監控磁碟分割槽和使用情況的幾個工具Linux
- 幾個常用的網路診斷命令
- Linux下監控流量常用的三大工具!Linux
- 【合集】Linux運維常用的服務監控工具Linux運維
- Linux系統效能監控採集項Linux
- Linux磁碟管理常用的三個命令!Linux
- linux最常用的20個命令(一)Linux
- Linux中監視日誌檔案常用的命令!Linux
- 注意啦!10 個你需要了解的 Linux 網路和監控命令Linux
- LoadRunner監控Unix、Windows方法及常用效能指標Windows指標
- 服務端思維指南 | 常用效能監控指南服務端
- linux常用的幾個系統介紹Linux
- Java生產環境效能監控與調優—基於JDK命令列工具的監控JavaJDK命令列
- 在Linux中,如何進行磁碟效能監控?Linux
- 常用的linux命令Linux
- Linux實驗的幾個基礎命令Linux
- 【Linux知識】7個常用的Linux網路命令!Linux
- linux開坑記–常用的3個命令Linux
- php效能監控PHP
- 前端效能監控前端
- Linux的幾個新手必備的命令(一)Linux