Linux 操作系统下 dstat 命令介绍和使用案例
dstat 命令介绍
dstat 是一个功能强大的 Linux 系统监控工具,旨在替代多个传统命令,如 vmstat、iostat、netstat、nfsstat 和 ifstat。它能够实时收集和显示系统性能数据,包括 CPU、内存、磁盘 I/O 和网络流量等信息,帮助用户快速识别和解决系统性能问题
特点
- 多功能:dstat 集成了多个命令的功能,提供更全面的系统监控。
- 实时更新:可以设置数据刷新频率,默认每秒更新一次。
- 易于扩展:支持插件,可以根据需要收集特定的数据
安装 dstat
root@rke2-25:/data# which dstat
root@rke2-25:/data# dstat
Command 'dstat' not found, but can be installed with:
apt install dstat # version 0.7.4-6, or
apt install pcp # version 5.0.3-1
root@rke2-25:/data# apt install dstat
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
dstat
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
Need to get 55.6 kB of archives.
After this operation, 466 kB of additional disk space will be used.
Get:1 http://mirrors.aliyun.com/ubuntu focal/universe amd64 dstat all 0.7.4-6 [55.6 kB]
Fetched 55.6 kB in 0s (310 kB/s)
Selecting previously unselected package dstat.
(Reading database ... 74063 files and directories currently installed.)
Preparing to unpack .../archives/dstat_0.7.4-6_all.deb ...
Unpacking dstat (0.7.4-6) ...
Setting up dstat (0.7.4-6) ...
/usr/share/dstat/dstat_mysql_keys.py:41: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
if op.debug > 1: print('%s: exception' (self.filename, e))
/usr/share/dstat/dstat_squid.py:48: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
if op.debug > 1: print('%s: exception' (self.filename, e))
Processing triggers for man-db (2.10.2-1) ...
Scanning processes...
Scanning linux images...
Running kernel seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
命令案例
1)默认情况下,dstat 会显示 CPU、磁盘、网络、页面和系统信息,每秒更新一次
2)找出资源占用最高的进程
dstat --top-mem --top-io --top-cpu
3)查看内存
dstat -g -l -m --top-mem
标签:...,操作系统,kB,--,0.7,installed,Linux,dstat From: https://blog.csdn.net/lisanmengmeng/article/details/143033492