Debian 10 Buster
Sponsored Link

SysStat : インストール2019/08/08

 
SysStat をインストールしてシステムの様々な情報を取得できるようにします。
[1] SysStat をインストールします。
root@dlp:~#
apt -y install sysstat
root@dlp:~#
vi /etc/default/sysstat
# 9行目:変更

ENABLED="
true
"
root@dlp:~#
systemctl restart sysstat
[2] システム情報の取得は以下のように cron にセットされたジョブにより実行されます。
・毎時 5-55分の間で 10分おきにサーバー情報がロギングされる。
・毎日 23時59分にログがローテートされる。
root@dlp:~#
cat /etc/cron.d/sysstat

# The first element of the path is a directory where the debian-sa1
# script is located
PATH=/usr/lib/sysstat:/usr/sbin:/usr/sbin:/usr/bin:/sbin:/bin

# Activity reports every 10 minutes everyday
5-55/10 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1

# Additional run at 23:59 to rotate the statistics file
59 23 * * * root command -v debian-sa1 > /dev/null && debian-sa1 60 2
[3] ログの保管期間等を変更する場合は以下のファイルに設定します。
root@dlp:~#
vi /etc/sysstat/sysstat
# sysstat configuration file. See sysstat(5) manual page.

# How long to keep log files (in days).
# Used by sa2(8) script
# 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(8) manual page)
# which are used for the generation of log files.
# By default contains the `-S DISK' option responsible for generating disk
# statisitcs. Use `-S XALL' to collect all available statistics.
# デフォルトでは取得されない設定となっている情報を追加取得するオプション *1
SADC_OPTIONS="-S DISK"

# *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
XALL    ⇒  All of the above (ALL + XDISK)
関連コンテンツ