十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
本篇文章给大家分享的是有关linux性能分析工具dstat是怎样的,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。
来安网站建设公司创新互联公司,来安网站设计制作,有大型网站制作公司丰富经验。已为来安数千家提供企业网站建设服务。企业网站搭建\外贸营销网站建设要多少钱,请找那个售后服务好的来安做网站的公司定做!
linux虽然有iostat或vmstat相关工具,dstat提供另一种可以监控磁盘及CPU或网络等性能瓶颈的全新方法。可以丰富分析诊断操作系统性能故障手段。
[root@three57 ~]# more /etc/redhat-release Red Hat Enterprise Linux Server release 6.8 (Santiago)
[root@three57 ~]# dstat -V Dstat 0.7.0
[root@three57 ~]# dstat --help Usage: dstat [-afv] [options..] [delay [count]] Versatile tool for generating system resource statistics Dstat options: -c, --cpu enable cpu stats -C 0,3,total include cpu0, cpu3 and total -d, --disk enable disk stats -D total,hda include hda and total -g, --page enable page stats -i, --int enable interrupt stats -I 5,eth3 include int5 and interrupt used by eth3 -l, --load enable load stats -m, --mem enable memory stats -n, --net enable network stats -N eth2,total include eth2 and total -p, --proc enable process stats -r, --io enable io stats (I/O requests completed) -s, --swap enable swap stats -S swap1,total include swap1 and total -t, --time enable time/date output -T, --epoch enable time counter (seconds since epoch) -y, --sys enable system stats --aio enable aio stats --fs, --filesystem enable fs stats --ipc enable ipc stats --lock enable lock stats --raw enable raw stats --socket enable socket stats --tcp enable tcp stats --udp enable udp stats --unix enable unix stats --vm enable vm stats --plugin-name enable plugins by plugin name (see manual) --list list all available plugins -a, --all equals -cdngy (default) -f, --full automatically expand -C, -D, -I, -N and -S lists -v, --vmstat equals -pmgdsc -D total --bw, --blackonwhite change colors for white background terminal --float force float values on screen --integer force integer values on screen --nocolor disable colors (implies --noupdate) --noheaders disable repetitive headers --noupdate disable intermediate updates --output file write CSV output to file delay is the delay in seconds between each update (default: 1) count is the number of updates to display before exiting (default: unlimited)
2,默认显示分为5个部分 第一部分 cpu部分 第二部分 磁盘读写 第三部分 网卡发送及接收 第四部分 换页换出 第五部分 上下文切换及中断 [root@three57 ~]# dstat ----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system-- usr sys idl wai hiq siq| read writ| recv send| in out | int csw 0 0 100 0 0 0| 76k 47k| 0 0 | 0 1B| 29 825 0 0 100 0 0 0| 0 0 | 66B 826B| 0 0 | 40 94 0 0 100 0 0 0| 0 0 | 66B 346B| 0 0 | 11 37 0 0 100 0 0 0| 0 0 | 66B 346B| 0 0 | 33 92 0 0 99 1 0 0| 0 56k| 66B 346B| 0 0 | 20 47 0 1 99 0 0 0| 0 0 | 66B 346B| 0 0 | 35 95 0 0 100 0 0 0| 0 0 | 66B 346B| 0 0 | 14 46 0 0 100 0 0 0| 0 0 | 66B 346B| 0 0 | 33 92 0 0 100 0 0 0| 0 0 | 66B 346B| 0 0 | 13 41 0 0 100 0 0 0| 0 0 | 66B 346B| 0 0 | 32 93 0 0 100 0 0 0| 0 0 | 66B 346B| 0 0 | 15 40 1 0 99 0 0 0| 0 0 | 66B 346B| 0 0 | 34 93 0 0 100 0 0 0| 0 0 | 66B 346B| 0 0 | 11 37 3,显示文件系统 [root@three57 ~]# dstat --fs --filesystem- files inodes 2752 37079 2752 37079 2752 37079 2752 37079 2752 37079 2752 37079 2752 37079 2752 37079 ^C [root@three57 ~]# 4,显示系统负载 [root@three57 ~]# dstat --load ---load-avg--- 1m 5m 15m 0.07 0.12 0.17 0.07 0.12 0.17 0.07 0.12 0.17 0.07 0.12 0.17^C [root@three57 ~]# 5,显示内存 [root@three57 ~]# dstat --mem ------memory-usage----- used buff cach free 540M 56.1M 1169M 113M 540M 56.1M 1169M 113M 540M 56.1M 1169M 113M 540M 56.1M 1169M 113M^C 6,显示进程 [root@three57 ~]# dstat --proc ---procs--- run blk new 0 0 0.6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0^C [root@three57 ~]# 7,显示时间 [root@three57 ~]# dstat --time ----system---- date/time 18-11 23:21:09 18-11 23:21:10 18-11 23:21:11 18-11 23:21:12 18-11 23:21:13 18-11 23:21:14 18-11 23:21:15 18-11 23:21:16 18-11 23:21:17^C [root@three57 ~]# [root@three57 ~]# dstat --time --mem ----system---- ------memory-usage----- date/time | used buff cach free 18-11 23:21:37| 540M 56.1M 1169M 113M 18-11 23:21:38| 540M 56.1M 1169M 113M 18-11 23:21:39| 540M 56.1M 1169M 113M 18-11 23:21:40| 540M 56.1M 1169M 113M^C 8,显示opoch [root@three57 ~]# dstat --time --mem --epoch ----system---- ------memory-usage----- --epoch--- date/time | used buff cach free| epoch 18-11 23:22:19| 540M 56.1M 1169M 113M|1574090539 18-11 23:22:20| 540M 56.1M 1169M 113M|1574090540 18-11 23:22:21| 540M 56.1M 1169M 113M|1574090541 18-11 23:22:22| 540M 56.1M 1169M 113M|1574090542^C 9,显示aio [root@three57 ~]# dstat --time --aio ----system---- async date/time | #aio 18-11 23:22:50|2661B 18-11 23:22:51|2661B 18-11 23:22:52|2661B 18-11 23:22:53|2661B 18-11 23:22:54|2661B^C 10,显示ipc [root@three57 ~]# dstat --time --ipc ----system---- --sysv-ipc- date/time |msg sem shm 18-11 23:23:18| 0 2 5 18-11 23:23:19| 0 2 5 18-11 23:23:20| 0 2 5^C 11,显示锁 [root@three57 ~]# dstat --time --lock ----system---- ---file-locks-- date/time |pos lck rea wri 18-11 23:23:48| 33 5.0 0 38 18-11 23:23:49| 33 5.0 0 38 18-11 23:23:50| 33 5.0 0 38 18-11 23:23:51| 33 5.0 0 38^C 12,显示socket [root@three57 ~]# dstat --time --socket ----system---- ------sockets------ date/time |tot tcp udp raw frg 18-11 23:24:26|391 9 7 0 0 18-11 23:24:27|391 9 7 0 0 18-11 23:24:28|391 9 7 0 0 18-11 23:24:29|391 9 7 0 0 18-11 23:24:30|391 9 7 0 0^C 13,显示tcp [root@three57 ~]# dstat --time --tcp ----system---- ----tcp-sockets---- date/time |lis act syn tim clo 18-11 23:24:52| 12 3 0 0 0 18-11 23:24:53| 12 3 0 0 0 18-11 23:24:54| 12 3 0 0 0 18-11 23:24:55| 12 3 0 0 0 18-11 23:24:56| 12 3 0 0 0 18-11 23:24:57| 12 3 0 0 0 18-11 23:24:58| 12 3 0 0 0 18-11 23:24:59| 12 3 0 0 0^C 14,显示所有可用插件 [root@three57 ~]# dstat --time --list internal: aio, cpu, cpu24, disk, disk24, disk24old, epoch, fs, int, int24, io, ipc, load, lock, mem, net, page, page24, proc, raw, socket, swap, swapold, sys, tcp, time, udp, unix, vm /usr/share/dstat: battery, battery-remain, cpufreq, dbus, disk-util, fan, freespace, gpfs, gpfs-ops, helloworld, innodb-buffer, innodb-io, innodb-ops, lustre, memcache-hits, MySQL-io, mysql-keys, mysql5-cmds, mysql5-conn, mysql5-io, mysql5-keys, net-packets, nfs3, nfs3-ops, nfsd3, nfsd3-ops, ntp, postfix, power, proc-count, rpc, rpcd, sendmail, snooze, thermal, top-bio, top-cpu, top-cputime, top-cputime-avg, top-io, top-latency, top-latency-avg, top-mem, top-oom, utmp, vm-memctl, vmk-hba, vmk-int, vmk-nic, vz-cpu, vz-io, vz-ubc, wifi 15,重定向到一个文件 [root@three57 ~]# dstat --time --aio --output /dstat.log ----system---- async date/time | #aio 18-11 23:27:33|2661B 18-11 23:27:34|2661B 18-11 23:27:35|2661B 18-11 23:27:36|2661B 18-11 23:27:37|2661B 18-11 23:27:38|2661B 18-11 23:27:39|2661B 18-11 23:27:40|2661B 18-11 23:27:41|2661B^C [root@three57 ~]# more /dstat.log "Dstat 0.7.0 CSV output" "Author:","Dag Wieers",,,,"URL:","http://dag.wieers.com/home-made/dstat/" "Host:","three57",,,,"User:","root" "Cmdline:","dstat --time --aio --output /dstat.log",,,,"Date:","18 Nov 2019 23:27:33 CST" "system","async" "date/time","#aio" 18-11 23:27:33,2661.0 18-11 23:27:34,2661.0 18-11 23:27:35,2661.0 18-11 23:27:36,2661.0 18-11 23:27:37,2661.0 18-11 23:27:38,2661.0 18-11 23:27:39,2661.0 18-11 23:27:40,2661.0 18-11 23:27:41,2661.0
以上就是linux性能分析工具dstat是怎样的,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注创新互联行业资讯频道。