10月24日任務linux
10.6 監控io性能ios
10.7 free命令ubuntu
10.8 ps命令centos
10.9 查看網絡狀態緩存
10.10 linux下抓包bash
[root@centos6 ~]# iostat -x Linux 2.6.32-642.el6.x86_64 (centos6.8) 10/24/2018 _x86_64_ (1 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 0.00 0.00 0.00 0.00 0.00 100.00 Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await r_await w_await svctm %util sda 0.00 0.02 0.01 0.01 0.33 0.28 37.95 0.00 1.08 1.96 0.57 0.75 0.00 dm-0 0.00 0.00 0.01 0.03 0.32 0.28 14.59 0.00 1.70 3.61 1.36 0.29 0.00 # iotop命令 [root@centos6 ~]# yum install -y iotop [root@centos6 ~]# iotop Total DISK READ: 0.00 B/s | Total DISK WRITE: 0.00 B/s TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND 256 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [mpt_poll_0] 1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % init 2 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kthreadd] 3 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [migration/0] 4 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ksoftirqd/0] 5 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [stopper/0] 6 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [watchdog/0] 7 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [events/0] 8 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [events/0] 9 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [events_long/0] 10 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [events_power_ef]
[root@centos6 ~]# free total used free shared buffers cached Mem: 1020024 228504 791520 164 15476 139472 -/+ buffers/cache: 73556 946468 Swap: 4194300 0 4194300 [root@centos6 ~]# free -h total used free shared buffers cached Mem: 996M 223M 773M 164K 15M 136M -/+ buffers/cache: 71M 924M Swap: 4.0G 0B 4.0G [root@centos6 ~]# free -m total used free shared buffers cached Mem: 996 223 773 0 15 136 -/+ buffers/cache: 71 924 Swap: 4095 0 4095
緩存: 0000(磁盤) --> 內存(cache)--> CPU 緩衝: CPU(000)--> 內存(buffer)--> 磁盤
[root@centos6 ~]# ps aux [root@centos6 ~]# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.1 19232 1496 ? Ss Oct16 0:00 /sbin/init root 2 0.0 0.0 0 0 ? S Oct16 0:00 [kthreadd] root 3 0.0 0.0 0 0 ? S Oct16 0:00 [migration/0] root 4 0.0 0.0 0 0 ? S Oct16 0:00 [ksoftirqd/0] root 5 0.0 0.0 0 0 ? S Oct16 0:00 [stopper/0] root 6 0.0 0.0 0 0 ? S Oct16 0:00 [watchdog/0] root 7 0.0 0.0 0 0 ? S Oct16 3:28 [events/0] root 8 0.0 0.0 0 0 ? S Oct16 0:00 [events/0] root 9 0.0 0.0 0 0 ? S Oct16 0:00 [events_long/0] root 10 0.0 0.0 0 0 ? S Oct16 0:00 [events_power_ef] root 11 0.0 0.0 0 0 ? S Oct16 0:00 [cgroup] root 12 0.0 0.0 0 0 ? S Oct16 0:00 [khelper] root 13 0.0 0.0 0 0 ? S Oct16 0:00 [netns] root 14 0.0 0.0 0 0 ? S Oct16 0:00 [async/mgr] root 15 0.0 0.0 0 0 ? S Oct16 0:00 [pm] root 16 0.0 0.0 0 0 ? S Oct16 0:01 [sync_supers] root 17 0.0 0.0 0 0 ? S Oct16 0:01 [bdi-default] root 18 0.0 0.0 0 0 ? S Oct16 0:00 [kintegrityd/0] root 19 0.0 0.0 0 0 ? S Oct16 0:00 [kblockd/0] root 20 0.0 0.0 0 0 ? S Oct16 0:00 [kacpid] root 21 0.0 0.0 0 0 ? S Oct16 0:00 [kacpi_notify] root 22 0.0 0.0 0 0 ? S Oct16 0:00 [kacpi_hotplug] root 23 0.0 0.0 0 0 ? S Oct16 0:00 [ata_aux] root 24 0.0 0.0 0 0 ? S Oct16 0:00 [ata_sff/0] root 25 0.0 0.0 0 0 ? S Oct16 0:00 [ksuspend_usbd] root 26 0.0 0.0 0 0 ? S Oct16 0:00 [khubd] root 27 0.0 0.0 0 0 ? S Oct16 0:00 [kseriod] root 28 0.0 0.0 0 0 ? S Oct16 0:00 [md/0] root 29 0.0 0.0 0 0 ? S Oct16 0:00 [md_misc/0] root 30 0.0 0.0 0 0 ? S Oct16 0:00 [linkwatch] root 33 0.0 0.0 0 0 ? S Oct16 0:00 [khungtaskd] root 34 0.0 0.0 0 0 ? S Oct16 0:00 [kswapd0] root 35 0.0 0.0 0 0 ? SN Oct16 0:00 [ksmd] root 36 0.0 0.0 0 0 ? SN Oct16 0:00 [khugepaged] root 37 0.0 0.0 0 0 ? S Oct16 0:00 [aio/0] root 38 0.0 0.0 0 0 ? S Oct16 0:00 [crypto/0] root 45 0.0 0.0 0 0 ? S Oct16 0:00 [kthrotld/0] root 46 0.0 0.0 0 0 ? S Oct16 0:00 [pciehpd] root 48 0.0 0.0 0 0 ? S Oct16 0:00 [kpsmoused] root 49 0.0 0.0 0 0 ? S Oct16 0:00 [usbhid_resumer] root 50 0.0 0.0 0 0 ? S Oct16 0:00 [deferwq] root 82 0.0 0.0 0 0 ? S Oct16 0:00 [kdmremove] root 83 0.0 0.0 0 0 ? S Oct16 0:00 [kstriped] root 114 0.0 0.0 0 0 ? S Oct16 0:00 [ttm_swap] root 247 0.0 0.0 0 0 ? S Oct16 0:00 [scsi_eh_0] root 249 0.0 0.0 0 0 ? S Oct16 0:00 [scsi_eh_1] root 256 0.0 0.0 0 0 ? S Oct16 0:08 [mpt_poll_0] root 257 0.0 0.0 0 0 ? S Oct16 0:00 [mpt/0] root 258 0.0 0.0 0 0 ? S Oct16 0:00 [scsi_eh_2] root 356 0.0 0.0 0 0 ? S Oct16 0:00 [kdmflush] root 417 0.0 0.0 0 0 ? S Oct16 0:00 [jbd2/dm-0-8] root 418 0.0 0.0 0 0 ? S Oct16 0:00 [ext4-dio-unwrit] root 493 0.0 0.0 10848 960 ? S<s Oct16 0:00 /sbin/udevd -d root 603 0.0 0.0 0 0 ? S Oct16 0:10 [vmmemctl] root 754 0.0 0.0 10848 980 ? S< Oct16 0:00 /sbin/udevd -d root 762 0.0 0.0 10780 912 ? S< Oct16 0:00 /sbin/udevd -d root 786 0.0 0.0 0 0 ? S Oct16 0:00 [jbd2/sda1-8] root 787 0.0 0.0 0 0 ? S Oct16 0:00 [ext4-dio-unwrit] root 820 0.0 0.0 0 0 ? S Oct16 0:00 [kauditd] root 1067 0.0 0.0 27596 848 ? S<sl Oct16 0:00 auditd root 1089 0.0 0.1 249088 1764 ? Sl Oct16 0:00 /sbin/rsyslogd -i /var/run/syslogd.pid -c 5 root 1165 0.0 0.1 66240 1200 ? Ss Oct16 0:00 /usr/sbin/sshd ntp 1176 0.0 0.2 30740 2152 ? Ss Oct16 0:01 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g root 1201 0.0 0.1 116908 1304 ? Ss Oct16 0:02 crond root 1214 0.0 0.0 4064 592 tty1 Ss+ Oct16 0:00 /sbin/mingetty /dev/tty1 root 1216 0.0 0.0 4064 592 tty2 Ss+ Oct16 0:00 /sbin/mingetty /dev/tty2 root 1218 0.0 0.0 4064 592 tty3 Ss+ Oct16 0:00 /sbin/mingetty /dev/tty3 root 1220 0.0 0.0 4064 592 tty4 Ss+ Oct16 0:00 /sbin/mingetty /dev/tty4 root 1222 0.0 0.0 4064 592 tty5 Ss+ Oct16 0:00 /sbin/mingetty /dev/tty5 root 1224 0.0 0.0 4064 588 tty6 Ss+ Oct16 0:00 /sbin/mingetty /dev/tty6 root 6066 0.0 0.0 0 0 ? S 16:00 0:00 [flush-253:0] root 6107 0.0 0.4 102548 4500 ? Ss 16:06 0:00 sshd: root@pts/0 root 6109 0.0 0.3 109756 3408 pts/0 Ss 16:06 0:00 -bash root 6128 0.0 0.1 110244 1172 pts/0 R+ 16:08 0:00 ps aux [root@centos6 ~]# 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 0 0 0 784840 16564 142408 0 0 0 0 7 7 0 0 100 0 0 0 0 0 784824 16564 142408 0 0 0 0 18 16 0 0 100 0 0 ^Z [1]+ Stopped vmstat 1 [root@centos6 ~]# ps aux |grep vmstat root 6155 0.0 0.0 6260 692 pts/0 T 16:32 0:00 vmstat 1 root 6157 0.0 0.0 103312 876 pts/0 S+ 16:33 0:00 grep --color=auto vmstat
[root@centos6 ~]# netstat -lnp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1165/sshd tcp 0 0 :::22 :::* LISTEN 1165/sshd udp 0 0 172.16.5.235:123 0.0.0.0:* 1176/ntpd udp 0 0 127.0.0.1:123 0.0.0.0:* 1176/ntpd udp 0 0 0.0.0.0:123 0.0.0.0:* 1176/ntpd udp 0 0 fe80::250:56ff:fea4:3d92:123 :::* 1176/ntpd udp 0 0 ::1:123 :::* 1176/ntpd udp 0 0 :::123 :::* 1176/ntpd Active UNIX domain sockets (only servers) Proto RefCnt Flags Type State I-Node PID/Program name Path unix 2 [ ACC ] STREAM LISTENING 7095 1/init @/com/ubuntu/upstart