幾個常用的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
- AIX常用的效能監控命令AI
- 常用的4個伺服器效能監控命令伺服器
- linux效能監控命令Linux
- 監控 Linux 效能的 18 個命令列工具Linux命令列
- 監控Linux效能的18個命令列工具Linux命令列
- 幾個常用監控工具的使用
- 監控 Linux 伺服器活動的幾個命令Linux伺服器
- Oracle效能監控常用命令Oracle
- Unix/Linux 常用監控命令Linux
- [轉載]監控 Linux 效能的 18 個命令列工具Linux命令列
- 監控 Linux 容器效能的命令列神器Linux命令列
- Linux中監控系統效能常用的命令!Linux
- 進行Linux效能監控的命令介紹Linux
- linux效能監控利器20個Linux
- Linux效能監控,安全等命令集Linux
- 幾個常用linux命令筆記Linux筆記
- 效能監控命令總結
- [zt] Linux中常用的監控CPU整體效能工具Linux
- Linux伺服器效能追蹤以及伺服器監控常用命令Linux伺服器
- Linux 效能監控工具Linux
- Linux常用效能命令Linux
- 監控 Linux 系統的 7 個命令列工具Linux命令列
- Oracle常用效能監控語句解析Oracle
- Redis 常用監控資訊命令總結Redis
- sar效能監視命令-實時監控CPU
- 高階 Linux 命令精通指南1,2,3 - Linux常用監控命令Linux
- Linux監控命令全解Linux
- Linux常用命令:效能命令Linux
- 監控oracle效能的一些常用查詢Oracle
- ☕[JVM效能專題](1)效能監控-命令列工具JVM命令列
- 你值得擁有:25 個 Linux 效能監控工具Linux
- 你值得擁有 —— 25 個 Linux 效能監控工具Linux
- DBA常用系統監控命令(之一)
- 10多個 Linux 系統管理員必備的監控工具、常用的網站監控工具Linux網站
- Git的幾個常用命令Git
- Linux常用的監控軟體介紹!Linux
- linux伺服器檢視監控頻寬的幾個工具Linux伺服器