温馨提示×

centos cpustat如何启动

小樊
43
2026-10-26 17:44:04
栏目: 智能运维

在 CentOS 上,cpustat 通常不是系统默认自带命令,而是来自 sysstat 工具集(或某些第三方工具)。下面分情况说明如何“启动/使用” cpustat。


一、确认是否是 sysstat 的 mpstat / sar 混淆

很多人说的 cpustat 实际是指:

  • mpstat(CPU 统计)
  • sar(系统活动报告)

1. 安装 sysstat

yum install -y sysstat

2. 启动 sysstat 服务(用于 sar 数据采集)

systemctl enable sysstat
systemctl start sysstat

3. 使用 CPU 统计命令

mpstat 1
mpstat -P ALL 1
sar -u 1

二、如果你指的是真实的 cpustat 工具(如 Go 写的 cpustat)

有些发行版/项目中有一个叫 cpustat 的工具(例如: github.com/uber-common/cpustat)

1. 安装(示例:Go 版 cpustat)

yum install -y golang git
go get github.com/uber-common/cpustat

2. 运行(需要 root)

sudo cpustat
sudo cpustat -i 1

三、如果你只是想“实时看 CPU 使用”

可以直接用:

top
htop
vmstat 1

四、快速判断你系统里有没有 cpustat

which cpustat
rpm -qf $(which cpustat)

如果你能贴一下:

  • CentOS 版本(cat /etc/redhat-release)
  • 你看到的 cpustat 是在哪篇文档/命令里

我可以更精确地告诉你该怎么启动。

0 踩