Linux ’sysstat‘ – how to use system activity report ’sar‘ to view performance information

root@rpi-iot-jsho-cam-02:/# vi /etc/default/sysstat
ENABLED=“true“
root@rpi-iot-jsho-cam-02:/# vi /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
root@rpi-iot-jsho-cam-02:/#
root@rpi-iot-jsho-cam-02:/# 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 use sadc’s option -D to prevent older
# data files from being overwritten. See sadc(8) and sysstat(5) manual pages.
HISTORY=7
# Compress (using xz, 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.
SADC_OPTIONS=“-S DISK“
# Directory where sa and sar files are saved. The directory must exist.
SA_DIR=/var/log/sysstat
# Compression program to use.
ZIP=“bzip2″
root@rpi-iot-jsho-cam-02:/# sar
Linux 5.10.63-v7l+ (rpi-iot-jsho-cam-02) 02/12/2022 _armv7l_ (4 CPU)
12:00:01 AM CPU %user %nice %system %iowait %steal %idle
12:05:01 AM all 33.14 0.01 20.91 0.06 0.00 45.88
12:15:02 AM all 33.03 0.00 20.93 0.06 0.00 45.99
12:25:01 AM all 33.63 0.00 20.89 0.03 0.00 45.44
12:35:01 AM all 33.00 0.00 21.00 0.06 0.00 45.95
12:45:01 AM all 33.18 0.00 20.79 0.04 0.00 45.99
12:55:01 AM all 33.10 0.00 20.80 0.04 0.00 46.06
01:05:01 AM all 33.21 0.00 20.98 0.03 0.00 45.77
01:15:01 AM all 32.94 0.00 20.79 0.05 0.00 46.23
01:25:02 AM all 32.75 0.00 20.96 0.06 0.00 46.24
01:35:01 AM all 33.21 0.00 20.68 0.03 0.00 46.08
01:45:01 AM all 33.05 0.00 20.91 0.04 0.00 46.00
01:55:01 AM all 32.14 0.00 20.81 0.04 0.00 47.01
02:05:01 AM all 32.10 0.00 20.79 0.04 0.00 47.07
02:15:01 AM all 32.08 0.00 20.89 0.04 0.00 46.98
02:25:01 AM all 32.70 0.00 21.23 0.04 0.00 46.04
02:35:01 AM all 32.24 0.00 20.74 0.04 0.00 46.98
02:45:01 AM all 32.01 0.00 21.03 0.03 0.00 46.93
02:55:01 AM all 32.04 0.00 20.87 0.05 0.00 47.04
03:05:01 AM all 32.10 0.00 20.94 0.04 0.00 46.92
03:15:01 AM all 32.06 0.00 20.85 0.06 0.00 47.03
03:25:01 AM all 32.20 0.00 20.88 0.03 0.00 46.88
03:35:01 AM all 31.90 0.00 20.96 0.04 0.00 47.11
03:35:01 AM CPU %user %nice %system %iowait %steal %idle
03:45:01 AM all 32.30 0.00 20.55 0.04 0.00 47.11
03:55:01 AM all 32.14 0.00 20.82 0.04 0.00 47.00
04:05:01 AM all 32.18 0.00 20.94 0.04 0.00 46.85
04:15:01 AM all 32.22 0.00 20.84 0.04 0.00 46.91
04:25:01 AM all 32.56 0.00 21.24 0.06 0.00 46.14
04:35:01 AM all 32.29 0.00 20.78 0.04 0.00 46.89
04:45:01 AM all 32.39 0.00 20.73 0.04 0.00 46.84
04:55:01 AM all 32.12 0.00 20.94 0.03 0.00 46.91
05:05:01 AM all 32.35 0.00 20.80 0.03 0.00 46.81
05:15:01 AM all 32.09 0.00 21.03 0.04 0.00 46.84
05:25:01 AM all 32.25 0.00 20.85 0.04 0.00 46.86
05:35:01 AM all 32.46 0.00 20.80 0.07 0.00 46.67
05:45:01 AM all 32.31 0.00 20.84 0.04 0.00 46.81
05:55:01 AM all 32.37 0.00 20.75 0.03 0.00 46.84
06:05:01 AM all 32.51 0.00 20.82 0.05 0.00 46.62
06:15:02 AM all 32.24 0.00 21.13 0.04 0.00 46.59
06:25:01 AM all 32.91 0.00 21.15 0.04 0.00 45.91
06:35:01 AM all 32.43 0.00 20.95 0.04 0.00 46.58
06:45:01 AM all 32.56 0.00 20.86 0.03 0.00 46.55
06:55:01 AM all 32.53 0.00 20.74 0.04 0.00 46.69
07:05:01 AM all 32.49 0.00 20.88 0.06 0.00 46.58
07:15:02 AM all 26.87 0.00 15.73 0.01 0.00 57.40
07:15:02 AM CPU %user %nice %system %iowait %steal %idle
07:25:01 AM all 25.19 0.00 12.58 0.00 0.00 62.23
07:35:01 AM all 25.18 0.00 12.68 0.00 0.00 62.14
07:45:01 AM all 24.85 0.00 13.10 0.00 0.00 62.04
07:55:01 AM all 24.45 0.00 13.15 0.00 0.00 62.39
08:05:01 AM all 24.48 0.00 13.42 0.00 0.00 62.10
08:15:01 AM all 24.55 0.00 13.18 0.00 0.00 62.27
Average: all 31.44 0.00 19.82 0.04 0.00 48.70

root@rpi-iot-jsho-cam-02:~#
root@rpi-iot-jsho-cam-02:~# ls -la /var/log/sysstat
total 240
drwxr-xr-x 2 root root 4096 Feb 12 06:25 .
drwxr-xr-x 8 root root 4096 Feb 12 07:08 ..
-rw-r–r– 1 root root 52092 Feb 12 00:00 sa11
-rw-r–r– 1 root root 84572 Feb 12 08:45 sa12
-rw-r–r– 1 root root 87312 Feb 12 06:25 sar11
root@rpi-iot-jsho-cam-02:~#

Leave a Reply

You must be logged in to post a comment.