SAR is called System Activity Report, is an tool in Linux System which collect, save and report CPU Usage, I/O usage, Memory(RAM), Virtual Memory(Vmem) and other resources of system. SAR tool provides facility and help system admins to get an overview to monitor system resources usage at different points of time.
It provides facility to monitor realtime system Performance.

In this article we will discuss different examples of SAR Command in CentOS 7, in case SAR is not installed on your system then use the below command to install it.

# yum install sysstat
To check working of SAR:
You can run this command to check the working of SAR on server:
# SAR 1 3
It will displays the server resources 3 times with one secong interval.

Syntax of SAR:
# sar [-A] [-B] [-b] [-C] [-d] [-F] [-H] [-h] [-p] [-q] [-R] [-r] [-S] [-t]
[-u [ALL]] [-V] [-v] [-W] [-w] [-y] [-I {int [,...] | SUM | ALL | XALL}]
[-P {cpu [,...] | ALL}] [-m {keyword [,...] | ALL}]
[-n {keyword [,...] | ALL}] [-j {ID | LABEL | PATH | UUID | ...}]
[-f [file name] | -o [file name] | -[0-9]+] [-i interval] [-s [hh:mm:ss]]
[-e [hh:mm:ss]] [interval [count]]
Now, we will check some options with SAR tool.

1. Monitor load average:
You can use (-q) option to obtain load average details. It will report the load averages of last 1,5 and 15 minutes.
# sar -q (Lists the details from the staring of this day)
# sar -q 1 4 (Lists load average details four times with an interval of on second)
# sar -q -f /var/log/sa/sa15 (Fetch load average details of date 15 of the month. Those files are located under “/var/log/sa/”).
2. Monitor Memory(RAM) details:
(-r) option will display the memory usage, which helps to determine the usage of RAM on a point of time.
# sar -r
# sar -r 1 3
# sar -r -f /var/log/sa/sa21
3. To check SWAP Memory usage:
Option (-S) will produce the Swap memory usage.
# sar -S
# sar -S 1 3
# sar -S -f /var/log/sa/sa9
4. To check resources usage from a certain time Or upto a certain period of time:
To get server usage details from a prticular time period Or upto a certain period of time, then you can use option (s) and (e) for start and end time respectively.
# sar -s 12:00:01
# sar -e 17:00:00
5. To report Paging statics:
6. To report I/O and transfer rate usage statistics:
7. Display statistics for currently mounted file systems:
8. To fetch records from a file:
# sar -f [file_name]
9. To report hugepages utilisation stats:
10. To report CPU utilisation:
# sar -u [ALL]
Author
bhawanisingh
Views
2,267
First release
Last update
Rating
0.00 star(s) 0 ratings
Top