CentOS Stream 10
Sponsored Link

SysStat : Install2025/02/07

 

Install SysStat to enable system monitoring like CPU usage or Network statics.

[1] Install SysStat.
[root@dlp ~]#
dnf -y install sysstat
[root@dlp ~]#
systemctl enable --now sysstat

[2] System resource data are recorded every 10 minutes by default.
However, if you'd like to change the interval, it's possible to edit like follows.
# default setting is like follows

[root@dlp ~]#
grep -A 1 'Timer' /usr/lib/systemd/system/sysstat-collect.timer

[Timer]
OnCalendar=*:00/10
# to change default 10 minutes, create a new config to override the default

[root@dlp ~]#
systemctl edit sysstat-collect.timer
### Editing /etc/systemd/system/sysstat-collect.timer.d/override.conf
### Anything between here and the comment below will become the new contents of>
# lie 3 : add
# set interval on [OnCalendar=***] (example below is every 5 minutes)
# empty value line [OnCalendar=] is needed to override default 10 minutes
[Unit]
Description=Run system activity accounting tool every 5 minutes

[Timer]
OnCalendar=
OnCalendar=*:00/5
AccuracySec=0

# new config is added

[root@dlp ~]#
ll /etc/systemd/system/sysstat-collect.timer.d/override.conf

-rw-r--r--. 1 root root 125 Feb 7 08:45 /etc/systemd/system/sysstat-collect.timer.d/override.conf
[3] If you'd like to change some settings of SysStat, the configuration file is located like follows.
[root@dlp ~]#
vi /etc/sysconfig/sysstat
# sysstat-12.7.6 configuration file.

# How long to keep log files (in days).
# If value is greater than 28, then use sadc's option -D to prevent older
# data files from being overwritten. See sadc(8) and sysstat(5) manual pages.
HISTORY=28

# Compress (using xz, 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.
# available option
#   INT     ⇒  System Interrupts
#   DISK    ⇒  Block Devices
#   SNMP    ⇒  SNMP statistics
#   IPV6    ⇒  IPv6 statistics
#   POWER   ⇒  Power Management statistics
#   ALL     ⇒  All of the above
#   XDISK   ⇒  DISK + Partition statistics
#   XALL    ⇒  All of the above (ALL + XDISK)
SADC_OPTIONS=" -S DISK"

# Directory where sa and sar files are saved. The directory must exist.
SA_DIR=/var/log/sa

# Compression program to use.
ZIP="xz"

# By default sa2 script generates yesterday's summary, since the cron job
# usually runs right after midnight. If you want sa2 to generate the summary
# of the same day (for example when cron job runs at 23:53) set this variable.
#YESTERDAY=no

# By default sa2 script generates reports files (the so called sarDD files).
# Set this variable to false to disable reports generation.
#REPORTS=false

# Tell sa2 to wait for a random delay in the range 0 .. ${DELAY_RANGE} before
# executing. This delay is expressed in seconds, and is aimed at preventing
# a massive I/O burst at the same time on VM sharing the same storage area.
# Set this variable to 0 to make sa2 generate reports files immediately.
DELAY_RANGE=0

# The sa1 and sa2 scripts generate system activity data and report files in
# the /var/log/sa directory. By default the files are created with umask 0022
# and are therefore readable for all users. Change this variable to restrict
# the permissions on the files (e.g. use 0027 to adhere to more strict
# security standards).
UMASK=0022

# The sa2 script uses the value below to set environment variable S_REPEAT_HEADER
# which is used by sar as the maximum number of lines after which a header has to
# be displayed (see sar(1) manual page).
#REPEAT_HEADER=25
Matched Content