Difference between revisions of "CentOS 8.x System Activity Reporter (sar)"

From Notes_Wiki
(Created page with "Home > CentOS > CentOS 8.x > System Administration > System Activity Reporter (sar) =Install sar= To install sar use: <pre> dnf -y install sysstat </pre> Start and enable sysstat service: <pre> systemctl start sysstat systemctl enable sysstat </pre> =Get history= ==CPU usage history== To get CPU usage history use: <pre> sar -u </pre> ==Ram usage history== To...")
 
m
 
Line 1: Line 1:
[[Main Page|Home]] > [[CentOS]] > [[CentOS 8.x]] > [[CentOS 8.x System Administration|System Administration]] > [[CentOS 8.x System Activity Reporter (sar)|System Activity Reporter (sar)]]
[[Main Page|Home]] > [[CentOS]] > [[CentOS 8.x]] > [[CentOS 8.x System Administration|System Administration]] > [[CentOS 8.x System Activity Reporter (sar)|System Activity Reporter (sar)]]
'''For debugging issues and not just collecting information for records, you can consider using [[Disk_usage_related_information#Using_atop_for_system_activity_recording_similar_to_sar|Atop for monitoring]] as it is way more versatile and detailed'''


=Install sar=
=Install sar=

Latest revision as of 04:41, 6 May 2023

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)