Red Hat Enterprise Linux 9 SysStat をインストールする手順

環境
Red Hat Enterprise Linux release 9.2 (Plow)
VMware Workstation 17 Player

操作方法
1.SysStat をインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# dnf -y install sysstat
# dnf -y install sysstat
# dnf -y install sysstat

2.sysStat を起動します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl enable --now sysstat
# systemctl enable --now sysstat
# systemctl enable --now sysstat

3.システムリソースの情報はデフォルトで 10 分間隔で取得されます。
1).デフォルトの取得間隔は以下の設定による

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

2).取得間隔を変更する場合は設定ファイルを新規作成してデフォルトをオーバーライドする

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl edit sysstat-collect.timer
# systemctl edit sysstat-collect.timer
# systemctl edit sysstat-collect.timer

3行目 : 以下のコードを追記する

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# 取得間隔を [OnCalendar=***] で設定 (下例は 5 分間隔)
# 値がブランクの [OnCalendar=] でデフォルトをオーバーライド
[Unit]
Description=Run system activity accounting tool every 5 minutes
[Timer]
OnCalendar=
OnCalendar=*:00/5
AccuracySec=0
# 取得間隔を [OnCalendar=***] で設定 (下例は 5 分間隔) # 値がブランクの [OnCalendar=] でデフォルトをオーバーライド [Unit] Description=Run system activity accounting tool every 5 minutes [Timer] OnCalendar= OnCalendar=*:00/5 AccuracySec=0
# 取得間隔を [OnCalendar=***] で設定 (下例は 5 分間隔)
# 値がブランクの [OnCalendar=] でデフォルトをオーバーライド
[Unit]
Description=Run system activity accounting tool every 5 minutes

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

3).以下のファイルが新規作成される

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 123 926 16:53 /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 123 9月 26 16:53 /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 123 9月 26 16:53 /etc/systemd/system/sysstat-collect.timer.d/override.conf

4.ログの保管期間等を変更する場合は以下のファイルで設定可能です。
# vi /etc/sysconfig/sysstat

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sysstat-12.5.4 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.
# デフォルトでは取得されない設定となっている情報を追加取得するオプション *1
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.
# サマリー生成の対象を昨日とするかどうか
# デフォルトは [yes]
# デフォルトのサマリー生成は [sysstat-summary.timer] により [00:07:00] に実行
#YESTERDAY=no
# By default sa2 script generates reports files (the so called sarDD files).
# Set this variable to false to disable reports generation.
# [sysstat-summary.service] 内で実行される [sa2] スクリプトで [sarDD] を生成するかどうか
# デフォルトは [true]
#REPORTS=false
# *1 指定可能なオプション
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
# sysstat-12.5.4 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. # デフォルトでは取得されない設定となっている情報を追加取得するオプション *1 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. # サマリー生成の対象を昨日とするかどうか # デフォルトは [yes] # デフォルトのサマリー生成は [sysstat-summary.timer] により [00:07:00] に実行 #YESTERDAY=no # By default sa2 script generates reports files (the so called sarDD files). # Set this variable to false to disable reports generation. # [sysstat-summary.service] 内で実行される [sa2] スクリプトで [sarDD] を生成するかどうか # デフォルトは [true] #REPORTS=false # *1 指定可能なオプション 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
# sysstat-12.5.4 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.
# デフォルトでは取得されない設定となっている情報を追加取得するオプション *1
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.
# サマリー生成の対象を昨日とするかどうか
# デフォルトは [yes]
# デフォルトのサマリー生成は [sysstat-summary.timer] により [00:07:00] に実行
#YESTERDAY=no

# By default sa2 script generates reports files (the so called sarDD files).
# Set this variable to false to disable reports generation.
# [sysstat-summary.service] 内で実行される [sa2] スクリプトで [sarDD] を生成するかどうか
# デフォルトは [true]
#REPORTS=false

# *1 指定可能なオプション
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

 

RHEL9

Posted by arkgame