Sysstat

From DikapediaV2
Revision as of 14:28, 11 September 2024 by Ardika Sulistija (talk | contribs) (Created page with "Add SAR notes here.</br> https://www.thegeekdiary.com/how-to-view-past-performance-with-sar-in-linux/ By default, sar stats are collected every 10 minutes. The data is collected using a simple cron job configured within /etc/cron.d/sysstat. This job can be amended to collect the data as frequently as you require. Example /etc/cron.d/sysstat file is provided below. # cat /etc/cron.d/sysstat # Run system activity accounting tool every 10 minutes */10 * * * * root /usr...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Add SAR notes here.
https://www.thegeekdiary.com/how-to-view-past-performance-with-sar-in-linux/


By default, sar stats are collected every 10 minutes. The data is collected using a simple cron job configured within /etc/cron.d/sysstat. This job can be amended to collect the data as frequently as you require. Example /etc/cron.d/sysstat file is provided below.

# cat /etc/cron.d/sysstat
# Run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib64/sa/sa1 1 1
# 0 * * * * root /usr/lib64/sa/sa1 600 6 &
# Generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib64/sa/sa2 -A


Install Sar


$ apt-get install sysstat       ### Debian-based distributions      
$ yum install sysstat           ### RedHat Based distribution


Sar log files


The historic data for various linux distribution is stored in below directories:
1. Red Hat, Fedora, CentOS, and Scientific Linux should use the /var/log/sa directory 2. Debian, Mint, and Ubuntu users should use the /var/log/sysstat directory


How to view or read sar files


-f: To read a sar log file:

sar -f /var/log/sa/sa20
00:00:00        CPU     %user     %nice   %system   %iowait    %steal     %idle
23:25:00        all      2.16      0.00      0.77      0.00      0.05     97.02
23:35:00        all      2.52      0.00      0.71      0.00      0.05     96.71
23:45:00        all      6.33      0.00      0.12      0.00      0.01     93.53

sar -f /var/log/sa/sa16 -b 
00:00:00          tps      rtps      wtps   bread/s   bwrtn/s
23:25:00        92.24      0.00     92.24      0.00    966.27
23:35:00        87.08      0.00     87.08      0.00   1236.60
23:45:00        22.55      0.00     22.55      0.00   3812.81

-b: Report I/O and transfer rate statistics. The following values are displayed:

tps
                    Total  number of transfers per second that were issued to
                    physical devices.  A transfer is  an  I/O  request  to  a
                    physical  device.  Multiple  logical requests can be com‐
                    bined into a single I/O request to the device.  A  trans‐
                    fer is of indeterminate size.
rtps
                    Total number of read requests per second issued to physi‐
                    cal devices.
wtps
                    Total number of write requests per second issued to phys‐
                    ical devices.
bread/s
                    Total  amount of data read from the devices in blocks per
                    second.  Blocks are equivalent to sectors  and  therefore
                    have a size of 512 bytes.