io性能 free ps 查看网络状态 linux抓包 linux网络相关

本文介绍了Linux系统中监控IO性能、查看内存、系统进程、网络状况和抓包的方法,如iostat、iotop、free、ps、netstat、tcp连接的三次握手和四次挥手过程,以及ip命令的使用,包括IP地址和路由的设置。
摘要由CSDN通过智能技术生成

监控io性能

在这里插入图片描述

iostat -x 磁盘使用

iostat 依赖的软件包是sysstat 和sar命令一样,在安装好sysstat之后,iostat也一样安装上了。%util是一个很重要的指标,如果io读写不打,%util很大,说明磁盘io严重不足。

在这里插入图片描述

iotop 查看那个进程占用io比较高

iotop命令是系统本身所没有,所以我们需要去安装iotop软件包,iotop命令和top命令相识,也是动态显示。如果磁盘io很高,我们想查看那个进程使用io比较大就需要用到iotop。

[root@linux-01 ceshi]# yum install -y iotop
已加载插件:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * epel: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.cn99.com
 * updates: mirrors.nju.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 iotop.noarch.0.0.6-4.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

=========================================================================================================================================
 Package                        架构                            版本                                 源                             大小
=========================================================================================================================================
正在安装:
 iotop                          noarch                          0.6-4.el7                            base                           52 k

事务概要
=========================================================================================================================================
安装  1 软件包

总下载量:52 k
安装大小:156 k
Downloading packages:
iotop-0.6-4.el7.noarch.rpm                                                                                        |  52 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : iotop-0.6-4.el7.noarch                                                                                               1/1 
  验证中      : iotop-0.6-4.el7.noarch                                                                                               1/1 

已安装:
  iotop.noarch 0:0.6-4.el7                                                                                                               

完毕!
[root@linux-01 ceshi]# 


[root@linux-01 ceshi]#  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 --switched-root --system --deserialize 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]
     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]
    23 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [edac-poller]
    24 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [watchdogd]
  6319 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % VGAuthService -s
    30 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kswapd0]
    31 be/5 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksmd]
    32 be/7 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [khugepaged]


free查看内存

centos7系统的free命令显示结果比centos6 更加简洁,大体内容上是一致的。

[root@izky8mg4viw1laz ~]#
[root@izky8mg4viw1laz ~]# free
              total        used        free      shared  buff/cache   available
Mem:        1883724      589260      504744       24872      789720     1112012
Swap:             0           0           0
[root@izky8mg4viw1laz ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:           1839         575         492          24         771        1085
Swap:             0           0           0
[root@izky8mg4viw1laz ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:           1.8G        575M        492M         24M        771M        1.1G
Swap:            0B          0B          0B
[root@izky8mg4viw1laz ~]#

free查看内存的使用情况
-m 以兆为单位显示
-h 人性化显示

系统总内存 (total)= used + free + buff / cache

系统可用内存(available) = free + 未使用量的buff / cache

[root@izky8mg4viw1laz ~]#
[root@izky8mg4viw1laz ~]# free
              total        used        free      shared  buff/cache   available
Mem:        1883724      589260      504744       24872      789720     1112012
Swap:             0           0           0

字段 含义
total 内存总大小
used 真正使用的实际内存大小
free 剩余物理内存大小
shared 共享物理内存大小
buff/cache 数据经过cpu写入磁盘,用的内存是buffer,数据经过磁盘交给cpu做运算处理,用的内存是cache
available 系统可使用内存有多大,它包含了free,还有没有被占用的buff+cache

ps 查看系统进程

在这里插入图片描述

[readonly@wxbManager ~]$ ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  19340  1116 ?        Ss    2017   0:47 /sbin/init
root         2  0.0  0.0      0     0 ?        S     2017   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S     2017   2:06 [migration/0]
root         4  0.0  0.0      0     0 ?        S     2017   4:04 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S     2017   0:00 [stopper/0]
root         6  0.0  0.0      0     0 ?        S     2017   0:58 [watchdog/0]
root         7  0.0  0.0      0     0 ?        S     2017   2:58 [migration/1]
root         8  0.0  0.0      0     0 ?        S     2017   0:00 [stopper/1]
root         9  0.0  0.0      0     0 ?        S     2017   5:45 [ksoftirqd/1]
root        10  0.0  0.0      0     0 ?        S     2017   0:52 [watchdog/1]
root        11  0.0  0.0      0     0 ?        S     2017  30:36 [events/0]
root        12  0.0  0.0      0     0 ?        S     2017 139:36 [events/1]
root        13  0.0  0.0      0     0 ?        S     2017   0:00 [events/0]
root        14  0.0  0.0      0     0 ?        S     2017   0:00 [events/1]
root        15  0.0  0.0      0     0 ?        S     2017   0:00 [events_long/0]
root        16  0.0  0.0      0     0 ?        S     2017   0:00 [events_long/1]
root        17  0.0  0.0      0     0 ?        S     2017   0:00 [events_power_ef]
root        18  0.0  0.0      0     0 ?        S     2017   0:00 [events_power_ef]
root        19  0.0  0.0      0     0 ?        S     2017   0:00 [cgroup]
root        20  0.0  0.0      0     0 ?        S     2017   0:00 [khelper]
root        21  0.0  0.0      0     0 ?        S     2017   0:00 [netns]
root        22  0.0  0.0      0     0 ?        S     2017   0:00 [async/mgr]
root        23  0.0  0.0      0     0 ?        S     2017   0:00 [pm]
root        24  0.0  0.0      0     0 ?        S     2017   0:00 [xenwatch]
root        25  0.0  0.0      0     0 ?        S     2017   0:00 [xenbus]
root        26  0.0  0.0      0     0 ?        S     2017   2:29 [sync_supers]
root        27  0.0  0.0      0     0 ?        S     2017   0:02 [bdi-default]
root        28  0.0  0.0      0     0 ?        S     2017   0:00 [kintegrityd/0]
root        29  0.0  0.0      0     0 ?        S     2017   0:00 [kintegrityd/1]
root        30  0.0  0.0      0     0 ?        S     2017   4:36 [kblockd/0]
root        31  0.0  0.0      0     0 ?        S     2017   0:02 [kblockd/1]
root        32  0.0  0.0      0     0 ?        S     2017   0:00 [kacpid]
root        33  0.0  0.0      0     0 ?        S     2017   0:00 [kacpi_notify]
root        34  0.0  0.0      0     0 ?        S     2017   0:00 [kacpi_hotplug]
root        35  0.0  0.0      0     0 ?        S     2017   0:00 [ata_aux]
root        36  0.0  0.0      0     0 ?        S     2017   0:00 [ata_sff/0]
root        37  0.0  0.0      0     0 ?        S     2017   0:00 [ata_sff/1]
root        38  0.0  0.0      0     0 ?        S     2017   0:00 [ksuspend_usbd]
root        39  0.0  0.0      0     0 ?        S     2017   0:00 [khubd]
root        40  0.0  0.0      0     0 ?        S     2017   0:00 [kseriod]
root        41  0.0  0.0      0     0 ?        S     2017   0:00 [md/0]
root        42  0.0  0.0      0     0 ?        S     2017   0:00 [md/1]
root        43  0.0  0.0      0     0 ?        S     2017   0:00 [md_misc/0]
root        44  0.0  0.0      0     0 ?        S     2017   0:00 [md_misc/1]
root        45  0.0  0.0      0     0 ?        S     2017   0:00 [linkwatch]
root        47  0.0  0.0      0     0 ?        S     2017   0:15 [khungtaskd]
root        48  0.0  0.0      0     0 ?        S     2017   6:07 [kswapd0]
root        49  0.0  0.0      0     0 ?        SN    2017   0:00 [ksmd]
root        50  0.0  0.0      0     0 ?        SN    2017   2:13 [khugepaged]
root        51  0.0  0.0      0     0 ?        S     2017   0:00 [aio/0]
root        52  0.0  0.0      0     0 ?        S     2017   0:00 [aio/1]
root        53  0.0  0.0      0     0 ?        S     2017   0:00 [crypto/0]
root        54  0.0  0.0      0     0 ?        S     2017   0:00 [crypto/1]
root        61  0.0  0.0      0     0 ?        S     2017   0:00 [kthrotld/0]
root        62  0.0  0.0      0     0 ?        S     2017   0:00 [kthrotld/1]
root        64  0.0  0.0      0     0 ?        S     2017   0:00 [kpsmoused]
root        65  0.0  0.0      0     0 ?        S     2017   0:00 [usbhid_resumer]
root        66  0.0  0.0      0     0 ?        S     2017   0:00 [deferwq]
root        98  0.0  0.0      0     0 ?        S     2017   0:00 [kdmremove]
root        99  0.0  0.0      0     0 ?        S     2017   0:00 [kstriped]
root       229  0.0  0.0      0     0 ?        S     2017   0:00 [scsi_eh_0]
root       230  0.0  0.0      0     0 ?        S     2017   0:00 [scsi_eh_1]
root       343  0.0  0.0      0     0 ?        S     2017  15:33 [jbd2/xvda1-8]
root       344  0.0  0.0      0     0 ?        S     2017   0:00 [ext4-dio-unwrit]
root       440  0.0  0.0  10760   876 ?        S<s   2017   0:00 /sbin/udevd -d
root       688  0.0  0.0      0     0 ?        S     2017  18:29 [flush-202:0]
root       772  0.0  0.0      0     0 ?        S     2017   0:00 [kauditd]
root       822  0.0  0.0      0     0 ?        S     2017   0:04 [ib_addr]
root       827  0.0  0.0      0     0 ?        S     2017   0:00 [infiniband/0]
root       828  0.0  0.0      0     0 ?        S     2017   0:00 [infiniband/1]
root       837  0.0  0.0      0     0 ?        S     2017   0:00 [ib_mcast]
root       842  0.0  0.0      0     0 ?        S     2017   0:00 [iw_cm_wq]
root       848  0.0  0.0      0     0 ?        S     2017   0:00 [ib_cm/0]
root       849  0.0  0.0      0     0 ?        S     2017   0:00 [ib_cm/1]
root       854  0.0  0.0      0     0 ?        S     2017   0:00 [rdma_cm]
root       875  0.0  0.0      0     0 ?        S     2017   0:00 [ipoib_flush]
root      1141  0.0  0.0 251960  5876 ?        Sl    2017   0:25 /sbin/rsyslogd -i /var/run/syslogd.pid -c 5
nscd      1164  0.0  0.0 630248  1480 ?        Ssl   2017  91:35 /usr/sbin/nscd
root      1276  0.0  0.0  66256  1196 ?        Ss    2017   0:02 /usr/sbin/sshd
ntp       1287  0.0  0.0  26600  1556 ?        Ss    2017   4:10 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
root      1352  0.0  0.0      0     0 ?        S     2017   0:00 [cqueue]
root      1393  0.0  0.0 116908  1324 ?        Ss    2017   1:18 crond
root      1832  0.0  0.4 591388 38044 ?        Sl    2017 479:37 /usr/bin/python2.7 /usr/bin/salt-minion -c /etc/salt -d
root      1833  0.0  0.3 493532 25796 ?        S     2017   0:00 /usr/bin/python2.7 /usr/bin/salt-minion -c /etc/salt -d
root      1994  0.0  0.0  31616    68 ?        Ssl   2017   0:00 /usr/sbin/gshelld
root      2011  0.0  0.0   4060   532 tty1     Ss+   2017   0:00 /sbin/mingetty /dev/tty1
root      2013  0.0  0.0   4060   536 tty2     Ss+   2017   0:00 /sbin/mingetty /dev/tty2
root      2015  0.0  0.0   4060   532 tty3     Ss+   2017   0:00 /sbin/mingetty /dev/tty3
root      2017  0.0  0.0   4060   532 tty4     Ss+   2017   0:00 /sbin/mingetty /dev/tty4
root      2019  0.0  0.0   4060   536 tty5     Ss+   2017   0:00 /sbin/mingetty /dev/tty5
root      2021  0.0  0.0   4060   532 tty6     Ss+   2017   0:00 /sbin/mingetty /dev/tty6
root      2022  0.0  0.0  10760   908 ?        S<    2017   0:00 /sbin/udevd -d
root      2023  0.0  0.0  10824   840 ?        S<    2017   0:00 /sbin/udevd -d
root      2362  0.0  0.0      0     0 ?        S     2017  10:49 [kjournald]
root      7331  0.0  0.0  45984  2520 ?        Ss    2017   0:00 nginx: master process /usr/local/nginx/sbin/nginx
root      9263  0.0  0.0  79104  1212 ?        S     2017   0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
root      9269  0.0  0.0  79104  1312 ?        S     2017 206:07 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
root      9270  0.0  0.0  79104  2168 ?        S     2017  36:43 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
root      9271  0.0  0.0  79104  2168 ?        S     2017  36:43 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
root      9272  0.0  0.0  79104  2168 ?        S     2017  36:48 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
root      9273  0.0  0.0  79108  2128 ?        S     2017 132:27 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
nobody    9595  0.0  0.3  73268 30672 ?        S    Feb14  13:00 nginx: worker process
nobody    9596  0.0  0.3  73668 30996 ?        S    Feb14  12:18 nginx: worker process
readonly 20493  0.0  0.0 110244  1140 pts/0    R+   22:55   0:00 ps aux
root     21063  0.0  0.0  25836  4360 ?        S<sl Jan21  33:10 /usr/local/aegis/aegis_update/AliYunDunUpdate
root     21111  0.2  0.2 129544 20356 ?        S<sl Jan21 331:01 /usr/local/aegis/aegis_client/aegis_10_59/AliYunDun
508      28984  0.0  0.0 106240   680 ?        S    Mar14   0:00 /bin/sh /home/10beiManager/tomcat/bin/catalina.sh start
508      28985  0.0  0.0   4112   624 ?        S    Mar14   2:29 /usr/sbin/cronolog /home/10beiManager/tomcat/logs/catalina.%Y-%m-%d.out
508      289
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值