Rocky Linux 8.5にSysStat をインストールする

2021年12月31日

説明
sysstat は、CPUやメモリの使用率やディスクI/Oの状態など監視・記録してくれるパッケージです。
環境
OSバージョン
# cat /etc/redhat-release
Rocky Linux release 8.5 (Green Obsidian)

インストールの方法
1.SysStat をインストールします
# dnf -y install sysstat

2.自動起動を設定します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl enable --now sysstat
ステータスを確認します
# systemctl status sysstat
● sysstat.service - Resets System Activity Logs
Loaded: loaded (/usr/lib/systemd/system/sysstat.service; enabled; vendor pre>
Active: active (exited) since Thu 2021-12-30 23:21:26 JST; 32s ago
# systemctl enable --now sysstat ステータスを確認します # systemctl status sysstat ● sysstat.service - Resets System Activity Logs Loaded: loaded (/usr/lib/systemd/system/sysstat.service; enabled; vendor pre> Active: active (exited) since Thu 2021-12-30 23:21:26 JST; 32s ago
# systemctl enable --now sysstat
ステータスを確認します
# systemctl status sysstat
● sysstat.service - Resets System Activity Logs
   Loaded: loaded (/usr/lib/systemd/system/sysstat.service; enabled; vendor pre>
   Active: active (exited) since Thu 2021-12-30 23:21:26 JST; 32s ago

3.システムリソースの情報取得間隔を確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# grep -A 1 'Timer' /usr/lib/systemd/system/sysstat-collect.timer
[Timer]
OnCalendar=*:00/10
# grep -A 1 'Timer' /usr/lib/systemd/system/sysstat-collect.timer [Timer] OnCalendar=*:00/10
# grep -A 1 'Timer' /usr/lib/systemd/system/sysstat-collect.timer
[Timer]
OnCalendar=*:00/10

4.取得間隔を変更します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl edit sysstat-collect.timer
以下の内容を編集します
[Unit]
Description=システムリソースの情報は5分間隔
[Timer]
OnCalendar=
OnCalendar=*:00/5
AccuracySec=0
# systemctl edit sysstat-collect.timer 以下の内容を編集します [Unit] Description=システムリソースの情報は5分間隔 [Timer] OnCalendar= OnCalendar=*:00/5 AccuracySec=0
# systemctl edit sysstat-collect.timer
以下の内容を編集します
[Unit]
Description=システムリソースの情報は5分間隔

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

オーバーライドファイルを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# ll /etc/systemd/system/sysstat-collect.timer.d/override.conf
-rw-r--r-- 1 root root 120 1230 23:26 /etc/systemd/system/sysstat-collect.timer.d/override.conf
# ll /etc/systemd/system/sysstat-collect.timer.d/override.conf -rw-r--r-- 1 root root 120 12月 30 23:26 /etc/systemd/system/sysstat-collect.timer.d/override.conf
# ll /etc/systemd/system/sysstat-collect.timer.d/override.conf
-rw-r--r-- 1 root root 120 12月 30 23:26 /etc/systemd/system/sysstat-collect.timer.d/override.conf

5.ログの保管期間を変更します
# vi /etc/sysconfig/sysstat

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sysstat-11.7.3 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.
# Block Devices
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
# sysstat-11.7.3 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. # Block Devices 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
# sysstat-11.7.3 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.
# Block Devices
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

 

Rocky Linux 8

Posted by arkgame