成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

聊聊監控工具Linux iotop

系統 Linux
iotop是一款開源、免費的用來監控磁盤I/O使用狀況的類似top命令的工具,iotop可以監控進程的I/O信息。

[[385443]]

本文轉載自微信公眾號「DBA閑思雜想錄」,作者瀟湘隱者。轉載本文請聯系DBA閑思雜想錄公眾號。

iotop的簡介:

iotop是一款開源、免費的用來監控磁盤I/O使用狀況的類似top命令的工具,iotop可以監控進程的I/O信息。它是Python語言編寫的,與iostat工具比較,iostat是系統級別的IO監控,而iotop是進程級別IO監控。目前最新的版本為iotop 0.6。其官方網址http://guichaz.free.fr/iotop/[1]

iotop的安裝:

注意,iotop的安裝有前提條件(如果操作系統不滿足這些條件,iotop無法正確安裝):

1:內核版本為2.6.20或更高版本

2:Python 2.7或更高的版本

官方文檔的詳細介紹如下:

  • Linux has always been able to show how much I/O was going on (the bi and bo columns of the vmstat 1 command).
  • Iotop is a Python program with a top like UI used to show of behalf of which process is the I/O going on. It requires Python ≥ 2.7 and a Linux kernel ≥ 2.6.20 with the TASK_DELAY_ACCT CONFIG_TASKSTATS, TASK_IO_ACCOUNTING and CONFIG_VM_EVENT_COUNTERS options on.

iotop的yum安裝

yum安裝是最簡單、快捷的。前提條件是你有配置yum的源配置。

  1. [root@DB-Server ~]# python -V 
  2. Python 2.7.5 
  3. [root@DB-Server ~]# uname -a 
  4. Linux DB-Server 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux 
  5. [root@DB-Server ~]#  
  6.   
  7.   
  8. [root@DB-Server ~]# yum -y install iotop 

iotop的源碼安裝

  1. wget http://guichaz.free.fr/iotop/files/iotop-0.6.tar.bz2 
  2. tar -xvf iotop-0.6.tar.gz  
  3. cd iotop-0.6 
  4. python setup.py build 
  5. python setup.py install 

iotop的參數

  1. # iotop --help 
  2. Usage: /usr/local/sbin/iotop [OPTIONS] 
  3.   
  4. DISK READ and DISK WRITE are the block I/O bandwidth used during the sampling 
  5. period. SWAPIN and IO are the percentages of time the thread spent respectively 
  6. while swapping in and waiting on I/O more generally. PRIO is the I/O priority at 
  7. which the thread is running (set using the ionice command). 
  8.   
  9. Controls: left and right arrows to change the sorting column, r to invert the 
  10. sorting order, o to toggle the --only option, p to toggle the --processes 
  11. option, a to toggle the --accumulated option, i to change I/O priority, q to 
  12. quit, any other key to force a refresh. 
  13.   
  14. Options: 
  15.   --version             show program's version number and exit 
  16.   -h, --help            show this help message and exit 
  17.   -o, --only            only show processes or threads actually doing I/O 
  18.   -b, --batch           non-interactive mode 
  19.   -n NUM, --iter=NUM    number of iterations before ending [infinite] 
  20.   -d SEC, --delay=SEC   delay between iterations [1 second] 
  21.   -p PID, --pid=PID     processes/threads to monitor [all] 
  22.   -u USER--user=USER  users to monitor [all] 
  23.   -P, --processes       only show processes, not all threads 
  24.   -a, --accumulated     show accumulated I/O instead of bandwidth 
  25.   -k, --kilobytes       use kilobytes instead of a human friendly unit 
  26.   -t, --time            add a timestamp on each line (implies --batch) 
  27.   -q, --quiet           suppress some lines of header (implies --batch) 

iotop的快捷鍵

r:反向排序,

o:切換至選項--only,

p:切換至--processes選項,

a:切換至--accumulated選項

q:退出

i:改變線程的優先級

iotop的例子

1:只顯示正在產生I/O的進程

  1. # iotop -o 

2:使用非交互模式將iotop命令輸出信息寫入日志

  1. #nohup iotop -b -o -n 10 -d 5 -t  > /tmp/iotop.log & 

3:借助iotop命令找到消耗I/O最高的進程,然后通過進程找到其正在執行的SQL語句

  1. # iotop -oP 
  2.  
  3.  PID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND                                                                                                                      
  4.  
  5. 11741 be/4 oracle      4.70 M/s    0.00 B/s  0.00 % 98.60 % ora_s004_SCM2 
  6.  
  7. 11739 be/4 oracle     66.99 M/s    0.00 B/s  0.00 % 93.30 % ora_s005_SCM2 
  8.  
  9. 11741 be/4 oracle     21.76 M/s    0.00 B/s  0.00 % 91.78 % ora_s006_SCM2 
  10.  
  11. 11743 be/4 oracle      4.87 M/s    3.78 M/s  0.00 % 27.74 % ora_s007_SCM2 
  12.  
  13. 11745 be/4 oracle     62.39 K/s    0.00 B/s  0.00 %  2.88 % ora_s008_SCM2 
  14.  
  15. 11733 be/4 oracle     39.00 K/s    0.00 B/s  0.00 %  2.08 % ora_s002_SCM2                 
  16.  
  17. 11697 be/4 oracle      0.00 B/s 1879.61 K/s  0.00 %  0.30 % ora_dbw0_SCM2 
  18.  
  19. 11699 be/4 oracle      0.00 B/s  102.36 K/s  0.00 %  0.20 % ora_lgwr_SCM2 

在找到消耗I/O最大的進程后,找出ORACLE進程正在執行的SQL語句

  1. SQL> @getsql_by_spid.sql 
  2.  
  3. Enter value for pid: 11741 
  4.  
  5. old  13:                                WHERE c.spid = '&pid')) 
  6.  
  7. new  13:                                WHERE c.spid = '11741')) 
  8.  
  9.   
  10.  
  11. SQL_TEXT 
  12.  
  13. -------------------------------------------- 
  14.  
  15. ...............................(實際環境中,這里會輸出SQL語句) 

getsql_by_spid.sql腳本如下所示:

  1. SELECT   /*+ ORDERED */ 
  2.          sql_text 
  3.     FROM v$sqltext a 
  4.    WHERE (a.hash_value, a.address) IN ( 
  5.             SELECT DECODE (sql_hash_value, 
  6.                            0, prev_hash_value, 
  7.                            sql_hash_value 
  8.                           ), 
  9.                    DECODE (sql_hash_value, 0, prev_sql_addr, sql_address) 
  10.               FROM v$session b 
  11.              WHERE b.paddr = (SELECT addr 
  12.                                 FROM v$process c 
  13.                                WHERE c.spid = '&pid')) 
  14. ORDER BY piece ASC 

這里只簡單列了幾個例子,因為iotop命令非常簡單,了解iotop的參數和快捷方式后,基本上只需根據實際需求去獲取進程或信息的I/O信息,剩下就是分析判斷了。

參考資料

 

[1]iotop: http://guichaz.free.fr/iotop/

 

責任編輯:武曉燕 來源: DBA閑思雜想錄
相關推薦

2019-05-05 15:20:32

Linuxiotop磁盤

2022-05-31 10:50:40

Linux監控工具

2020-09-16 08:03:45

Linux網絡工具

2014-02-09 10:20:44

監控工具Linux服務器

2020-06-17 07:40:26

監控系統zabbix

2011-01-06 13:45:51

linux流量監控iftop

2010-05-27 12:52:42

Linux流量監控軟件

2014-06-18 10:47:05

dstat監控工具

2020-11-16 18:53:16

Linux網絡監控工具網絡通訊

2022-03-11 08:35:06

數據庫存儲監控

2024-05-11 11:18:21

Kafka監控框架

2020-05-29 15:25:30

Linux 監控 工具

2010-05-19 10:14:41

vmstatLinux系統監控工具

2020-11-18 11:05:07

Linux網絡監控工具代碼

2013-08-19 09:53:01

系統監控lsof 監控工具

2020-08-31 09:01:16

GlancesLinux系統監控工具

2010-05-19 09:33:27

Linux系統監控工具top

2023-02-26 14:34:18

OSW操作系統監控

2020-06-19 08:04:23

監控系統

2022-08-02 20:21:42

開源項目工具
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 国产精品永久 | 一区二区三区四区在线 | 亚洲精品久久久久中文字幕欢迎你 | 伊人性伊人情综合网 | 美女一区二区在线观看 | 一本色道精品久久一区二区三区 | 国产日韩一区 | 久久久精品日本 | 国产精品日韩欧美一区二区三区 | 国产一区二区在线视频 | 91视频在线网站 | 久久久久久国产精品 | 精品久久久久久红码专区 | 免费视频一区二区三区在线观看 | 亚洲欧美日韩精品久久亚洲区 | 麻豆视频在线看 | 成人午夜网站 | 成人免费黄色片 | 成人三级视频在线观看 | 在线视频亚洲 | 91免费高清 | 成人免费黄视频 | 日韩在线免费视频 | 在线免费小视频 | 91欧美激情一区二区三区成人 | 99re国产精品 | 97精品超碰一区二区三区 | 岛国视频 | 欧美黄色一区 | 99久久久99久久国产片鸭王 | 人人人人干 | 99久久久久久99国产精品免 | 国产高清久久久 | 九九热免费观看 | 精品国产不卡一区二区三区 | 国产精品夜夜春夜夜爽久久电影 | 日本午夜一区二区三区 | 91人人在线 | hitomi一区二区三区精品 | 国产目拍亚洲精品99久久精品 | 欧美黄色一区 |