下载
cd /usr/local/src
wget [https://github.com/sysstat/sysstat/releases/download/v12.5.7/sysstat-12.5.7.tar.xz](https://github.com/sysstat/sysstat/releases/download/v12.5.7/sysstat-12.5.7.tar.xz)
解压
sudo tar -xvf sysstat-12.5.7.tar.xz cd sysstat-12.5.7
编译安装
mkdir -p /usr/local/sysstat
sudo ./configure --prefix=/usr/local/sysstats
sudo make sudo make install
配置服务与定时任务
cat /etc/sysconfig/sysstat <<EOF
# sysstat-10.1.5 configuration file.
# How long to keep log files (in days).
# If value is greater than 28, then log files are kept in
# multiple directories, one for each month.
HISTORY=28
# Compress (using gzip or bzip2) sa and sar files older than (in days):
COMPRESSAFTER=31
# Parameters for the system activity data collector (see sadc manual page)
# which are used for the generation of log files.
SADC_OPTIONS="-S DISK"
# Compression program to use.
ZIP="bzip2"
EOF
配置定时任务
sudo vi /etc/cron.d/sysstat
每 10 分钟收集一次性能数据
*/10 * * * * root /usr/lib64/sa/sa1 1 1
每天凌晨 12 点汇总数据
0 0 * * * root /usr/lib64/sa/sa2 -A