CentOS 8.x System Activity Reporter (sar)

From Notes_Wiki

Home > CentOS > CentOS 8.x > System Administration > System Activity Reporter (sar)

For debugging issues and not just collecting information for records, you can consider using Atop for monitoring as it is way more versatile and detailed

Install sar

To install sar use:

dnf -y install sysstat

Start and enable sysstat service:

systemctl start sysstat
systemctl enable sysstat


Get history

CPU usage history

To get CPU usage history use:

sar -u


Ram usage history

To get RAM usage history use:

sar -r


Swap usage history

To get Swap usage history use:

sar -S


Get I/O history

To get Input/Ouput bytes read/written per second history use:

sar -b


Refer:



Miscellaneous SAR issues

Getting history for previous days

For all the commands by default todays history is listed. However sar stores older history at '/var/log/sa' with filename such as 'sa-<date>'. For example 24th day of month history would be in file 'sa24'. We can read the history for a given date using '-f /var/log/sa/<file-name>'

For example

sar -u -f /var/log/sa/sa24


Sar files and sar installed must be of same version

It is not guaranteed that we can take the sar files from a system '/var/log/sa*' and read it using different version of sar on another system. There is no guarantee of backward compatibility either. If you try to read older version sar files using new sar software then following error is possible:

$ sar -u -f sa18 
Invalid system activity file: sa18
File created by sar/sadc from sysstat version 10.1.5
Current sysstat version cannot read the format of this file (0x2171)
# rpm -qa | grep sysstat
sysstat-11.7.3-7.el8.x86_64

Thus, we cant read sar 10.1.5 output data via sar 11.7.3



Home > CentOS > CentOS 8.x > System Administration > System Activity Reporter (sar)