sysstat配置:
cat /etc/sysconfig/sysstat
# sysstat-9.0.4 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=7
# Compress (using gzip or bzip2) sa and sar files older than (in days):
COMPRESSAFTER=10
# Parameters for the system activity data collector (see sadc manual page)
# which are used for the generation of log files.
SADC_OPTIONS="-S DISK"sysstat cron条目:
cat /etc/cron.d/sysstat
# Run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib64/sa/sa1 1 1
# 0 * * * * root /usr/lib64/sa/sa1 600 6 &
# Generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib64/sa/sa2 -A发布于 2018-02-23 01:41:10
你不能直接这么做。sar(系统)和朋友基本上只限于日常记录。来自"sadc.c“(在sysstat-11.7.2中):
485 void setup_file_hdr(int fd)
486 {
...
507 file_hdr.sa_day = rectime.tm_mday;
508 file_hdr.sa_month = rectime.tm_mon;
509 file_hdr.sa_year = rectime.tm_year;因此,文件头只包含一天。
有些令人信服的是个人记录的格式。来自"sa.h":
604 struct record_header {
...
617 /*
618 * Timestamp: Hour (0-23), minute (0-59) and second (0-59).
619 * Used to determine TRUE time (immutable, non locale dependent time).
620 */
621 unsigned char hour;
622 unsigned char minute;
623 unsigned char second;但是,该结构还包含机器运行时间(每秒1/100)和自该时代以来的秒数。我需要做更多的工作,看看这些值是如何使用的(我不打算这么做),所以这更像是一个提示,而不是证据。
https://unix.stackexchange.com/questions/425317
复制相似问题