温馨提示×

centos cpustat怎么开

小樊
47
2026-10-17 20:41:38
栏目: 智能运维

在 CentOS 上,cpustat 通常不是系统默认自带的命令,它一般来自 sysstat 工具包(更准确地说,mpstat / sar 是 sysstat 的,cpustat 多由 pcp(Performance Co-Pilot) 或 goldwynr/cpustat 提供)。下面分情况说明怎么“开”和用。


一、如果是 sysstat 的 CPU 监控(最常用)

很多人把 mpstat 当成 cpustat。

1. 安装 sysstat

yum install -y sysstat

2. 启动并开机自启

systemctl enable sysstat
systemctl start sysstat

3. 使用

mpstat 1
mpstat -P ALL 1

二、如果是真正的 cpustat 命令(来自 pcp)

CentOS 7/8 可通过 pcp 安装:

yum install -y pcp
systemctl enable pmcd
systemctl start pmcd

使用:

cpustat 1

三、如果是 GitHub 的 cpustat(Go 版本)

如果是这个:https://github.com/uber-archive/cpustat

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

运行:

cpustat

四、如果只是想“看 CPU 使用率”

不装东西也能用:

top
htop   # yum install -y htop
vmstat 1

如果你能告诉我:

  • CentOS 版本(7 / 8 / Stream)
  • 你看到的 cpustat 是在哪篇文档或报错里

我可以直接给你精确的一条命令。

0 踩