在 CentOS 上,cpustat 通常不是系统默认自带的命令,它一般来自 sysstat 包或 cpustat 工具(不同来源含义略有不同)。下面分情况说明怎么装:
mpstat / iostat 这类 CPU 统计工具(最常见)这些其实来自 sysstat 包,里面包含 mpstat、sar、iostat 等。
yum install -y sysstat
mpstat 1
mpstat -P ALL 1
cpustat 命令(来自 GitHub 工具)有些发行场景下的 cpustat 是第三方工具(如 tools/cpustat)。
先启用 EPEL:
yum install -y epel-release
yum install -y cpustat
注意:并不是所有 CentOS 版本 EPEL 里都有
cpustat
yum install -y git gcc make
git clone https://github.com/influxdata/cpustat.git
cd cpustat
make
cp cpustat /usr/local/bin/
使用:
cpustat 1
which cpustat
which mpstat
rpm -qa | grep sysstat
如果你能贴一下:
cpustat 是在哪里(文档 / 课程 / 报错)我可以给你最准确的一条安装命令。