How to use SAR in Linux

0
342

System Activity Report (SAR) is a Unix System monitor command used to report on various system loads. So it including CPU activity, memory/paging, interrupts, device load, network and swap space utilization. Sar uses /procfilesystem to collect information. However, It is very easy to install and it is available package on many distributions.

In this article we will install SAR and run different examples of SAR Commands.

yum install -y sysstat

OR

sudo apt-get install sysstat

Start SAR service, enable it on boot.

systemctl start sysstat.service
systemctl enable sysstat.service
systemctl status sysstat.service

SAR reports are stores in /var/log/sa directory. A script “sa1” logs SAR output into sysstat binary log file format, and translate it into human readable format in “sar1” file.

Each sar report saved with current date.
e.g if today is 17th the sar report will save as sa17 in binary file and sar17 in human readable file.

To list sar files, you can use following command

ls /var/log/sa

Run below command to see system statistics

sar

There are many commands of sar, however some are given below which may helpful for you.

Server’s average load history

You can use following command to check average load on the server.

sar -q

ALL CPU utilization statistics

Now, use below command to see how much total CPU is consumed.

sar -u

Memory utilization statistics

So, If you want to check memory utilization stats, use following command.

sar -r

Memory statistics

sar -R

I/O and transfer rate statistics

sar -b

Paging statistics

sar -B

Mount Filesystems statistics

Then, If you want to see mounted filesystems execute below command.

sar -F

Swap space utilization statistics

But what if you wanna see how much SWAP space is using? then issue below command

sar -S

Kernel table statistics

sar -v

TTY device statistics

sar -y

Now you can add sar in your system administration tool to manage and monitor server activities.

LEAVE A REPLY

Please enter your comment!
Please enter your name here