SysStat : インストール2025/02/07 |
SysStat をインストールして CPU やメモリー使用量等々の、システムリソースの情報を取得できるようにします。 |
|
[1] | SysStat をインストールします。 |
[root@dlp ~]#
[root@dlp ~]# dnf -y install sysstat systemctl enable --now sysstat |
[2] | システムリソースの情報はデフォルトで 10 分間隔で取得されます。 取得間隔を変更したい場合は以下のように変更可能です。 |
# デフォルトの取得間隔は以下の設定による [root@dlp ~]# grep -A 1 'Timer' /usr/lib/systemd/system/sysstat-collect.timer [Timer] OnCalendar=*:00/10 ### Editing /etc/systemd/system/sysstat-collect.timer.d/override.conf ### Anything between here and the comment below will become the new contents of> # 3行目 : 追記 # 取得間隔を [OnCalendar=***] で設定 (下例は 5 分間隔) # 値がブランクの [OnCalendar=] でデフォルトをオーバーライド [Unit] Description=Run system activity accounting tool every 5 minutes [Timer] OnCalendar= OnCalendar=*:00/5 AccuracySec=0 # 以下のファイルが新規作成される [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] | ログの保管期間等を変更する場合は以下のファイルで設定可能です。 |
[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. # デフォルトでは取得されない設定となっている情報を追加取得するオプション # * 指定可能なオプション # 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. # サマリー生成の対象を昨日とするかどうか # デフォルトは [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 # 実行前ディレイの時間 (秒 - 指定した秒数内でランダムに待つ) # 同一ストレージ上に多数の仮想マシンがデータを出力するような環境において有効な設定 # 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 # 出力するデータファイルの umask 値 # 一般ユーザーに見せたくない場合は 027 や 077 にする # 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 # [sar] コマンドでデータを参照する際のヘッダーを挿入する行間隔 # 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 |
Sponsored Link |
|