Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the Linux dstat command

2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to use the Linux dstat command". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this article "how to use the Linux dstat command" can help you solve the problem.

Linux common commands dstat command is a tool used to replace vmstat, iostat, netstat, nfsstat and ifstat commands, is an omnipotent system information statistics tool.

A general system resource statistics tool for dstat

It is added that the dstat command is a tool used to replace vmstat, iostat, netstat, nfsstat and ifstat commands, and is an omnipotent system information statistics tool. Compared with sysstat, dstat has a colored interface that makes the data conspicuous and easy to observe when manually observing performance; and dstat supports instant refresh, such as typing dstat 3, that is, collecting every three seconds, but the latest data is refreshed every second. Like sysstat, dstat can also collect specified performance resources, such as dstat-c, which shows the usage of CPU.

Download installation method 1

Yum install-y dstat method II

Download address on the official website: http://dag.wieers.com/rpm/packages/dstat

Wget http://dag.wieers.com/rpm/packages/dstat/dstat-0.6.7-1.rh7.rf.noarch.rpm rpm-ivh dstat-0.6.7-1.rh7.rf.noarch.rpm can be used after installation. Dstat is very powerful and can monitor the usage of cpu, disk, network, IO, memory and so on in real time.

Use dstat directly. The-cdngy parameter is used by default, which displays cpu, disk, net, page and system information respectively. The default is 1s to display a message. You can specify the time interval at which a message is displayed at the end. For example, dstat 5 does not show one in 5s, and dstat 510 indicates that it does not show one in 5s. A total of 10 messages are displayed.

[root@iZ23uulau1tZ ~] # dstat-total-cpu-usage-----dsk/total--net/total- paging-- system-- usr sys idl wai hiq siq | read writ | recv send | in out | int csw 00 99 00 0 | 7706B 164k | 00 | 00 | 189 225 00 100 00 | 00 | 4436B 826B | 00 | 195 2481 0 99 00 | 00 | 4744B 346B | 00 | 203 242 00 100 00 | 00 | 5080B 346B | 00 | 206 242 0 1 99 00 | 00 | 5458B 444B | 00 | 214 244 10 99 00 | 00 | 5080B 346B | 00 | some of the information shown below is explained below:

Cpu:hiq and siq are hard interrupts and soft interrupts, respectively.

System:int and csw are the interrupts (interrupt) and context switching (context switch) of the system, respectively.

Everything else is easy to understand.

Syntax dstat [- afv] [options..] [delay [count]] Common option-c: display information such as CPU system occupation, user occupation, idle, wait, interrupt, software interrupt, etc. -C: when there are multiple CPU, this parameter can display the cpu status as needed, for example:-C 0Power1 shows the information of cpu0 and cpu1. -d: displays the read and write data size of the disk. -D hda,total:include hda and total. -n: displays the network status. -N eth2,total: specify the network card to display when there are multiple network cards. -l: displays the system load. -m: displays memory usage. -g: displays the page usage. -p: displays the process status. -s: displays the usage of the swap partition. -S: similar to DhampN. -r:I/O request status. -y: system status. -- ipc: displays ipc message queues, signals and other information. -- socket: used to display the tcp udp port status. -a: this is the default option and is equivalent to-cdngy. -v: equivalent to-pmgdsc-D total. -- output file: this option is also useful to redirect status information to a specified file in csv format for later viewing. Example: dstat-- output / root/dstat.csv & now let the program run silently in the background and output the results to the / root/dstat.csv file. Of course, there are many more advanced uses of dstat, the basic options commonly used, and more advanced uses can be combined with man documents.

For example, if you want to monitor swap,process,sockets,filesystem and display the monitoring time:

[root@iZ23uulau1tZ ~] # dstat-tsp-- socket-- fs-system---- swap--- procs----sockets- filesystem- date/time | used free | run blk new | tot tcp udp raw frg | files inodes 26-07 09:23:48 | 0 | 0 6488 26-07 09:23:49 | 0 | 0 0 0 26-07 0 0 | | | 6488 | 104 8500 | 704 6488 26-07 09:23:50 | 0 | 0 0 | 104 8 50 | 704 6489 26-07 09:23:51 | 0 0 | 0 6489 26-07 09:23:52 | 00 | 0 0 0 | 104 8 500 | 70 4 000 26-07 09:23:53 | 0 0 | | 6489 | 1048500 | 704 6489 to output the result to a file, you can add-- output filename:

[root@iZ23uulau1tZ ~] # dstat-tsp-- socket-- fs-- output / tmp/ds.csv-system---- swap--- procs----sockets- filesystem- date/time | used free | run blk new | tot tcp udp raw frg | files inodes 26-07 09:25:31 | 0 | 0 6493 | 104 8 500 | 736 000 26-07 09 : 25:32 | 00 | 0 6493 | 104 8500 | 736 6493 26-07 09:25:33 | 0 | 0 0 | 104 8 500 | 736 6493 26-07 09:25:34 | 0 | 0 0 | 104 8 500 | 736 6493 26-07 09:25:35 | 0 | 0 0 | 104 8 500 | 736 6494 26-07 09 : 25:36 | 0 | 0 6494 | 104 8500 | 736 6494 the generated csv file can be opened with excel Then generate the chart.

You can check all the parameters that can be used by dstat through dstat-- list. The above internal is some monitoring parameters of dstat itself, and the following / usr/share/dstat is the plug-in of dstat. These plug-ins can extend the functions of dstat, such as monitoring power supply (battery), mysql and so on.

Not all of the following plug-ins can be used directly, and some rely on other packages. For example, if you want to monitor mysql, you must install some packages that connect to mysql with python.

[root@iZ23uulau1tZ ~] # dstat-- 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, cpufreq, dbus, dbus, disk-util, fan, 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 That's all for vz-io, vz-ubc, wifi on "how to use the Linux dstat command". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 252

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report