Linux 操作系统下 dstat 命令介绍和使用案例

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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lisanmengmeng

蚊子腿也是肉

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值