温馨提示×

如何安装debian cpustat

小樊
36
2026-09-25 21:34:04
栏目: 智能运维

在 Debian 系统上,cpustat 通常是指 sysstat 软件包里提供的性能监控工具,或者是 cpustat(Go 编写的工具)。下面分别说明。


一、安装 sysstat 中的 cpustat(常见方式)

很多用户说的 cpustat 实际是 mpstat / sar 等 sysstat 工具集的一部分,但 Debian 官方仓库里并没有单独叫 cpustat 的命令来自 sysstat。
如果你只是想监控 CPU 使用率,推荐直接安装 sysstat:

sudo apt update
sudo apt install sysstat

使用方式:

mpstat 1
sar -u 1 3

二、安装 GitHub 上的 cpustat(pebble/cpustat)

如果你指的是这个工具:
https://github.com/pebble/cpustat

方法 1:用 Go 安装(推荐)

  1. 安装 Go(Debian 12+):
sudo apt install golang-go
  1. 安装 cpustat:
go install github.com/pebble/cpustat@latest
  1. 加入 PATH(如果未自动加入):
export PATH=$PATH:$(go env GOPATH)/bin
  1. 使用:
cpustat

方法 2:手动下载二进制(无 Go 环境)

  1. 查看最新版本:
    https://github.com/pebble/cpustat/releases

  2. 示例(以 amd64 为例):

wget https://github.com/pebble/cpustat/releases/download/v1.0.0/cpustat-v1.0.0-linux-amd64.tar.gz
tar -xzf cpustat-v1.0.0-linux-amd64.tar.gz
sudo mv cpustat /usr/local/bin/
  1. 验证:
cpustat --help

三、确认你需要的“cpustat”

你可以先运行:

which cpustat
man cpustat

如果你能告诉我:

  • Debian 版本(如 11 / 12)
  • 是否使用 Go
  • 想要的是“系统自带CPU统计”还是“进程级CPU监控”

我可以给你更精确的命令。

0 踩