What is SAR utility and how to use it?
SAR stands for System Activity Report. Using SAR we can check the information of CPU usage, memory, swap, I/O, disk I/O, networking and paging. We can get the information of the present status and post status
(history using the data) upto last 7 days because HISTORY=7
is there in the configuration file. The log messages are stored in /var/log/sa/sa1, /var/log/sa/sa2, /var/log/sa/sa3
, ….etc., (where 1, 2, 3, ….etc., are dates). The SAR configuration is stored in /etc/sysconfig/sysstat
file. In this file the default option will be there. So, we can change the default 7 days to our required value.
How to install the SAR utility package by command.
# yum install sysstat* -y
Examples:
Using sar command to monitor system performance
The sar command is a useful tool for monitoring various system performance metrics in Linux. It can provide insights into CPU utilization, memory usage, disk usage, and more. Here are some examples of how to use the sar command to monitor system performance:
Monitoring CPU Utilization:
# sar -p 2 10
This command will display CPU utilization for every 2 seconds, up to 10 times.
Checking CPU Utilization on a Specific Day:
# sar -p ALL -f /var/log/sa/sa25
This command will display the CPU utilization on the 25th day of the current month.
Checking CPU Utilization During Specific Time Frame:
# sar -p ALL -f /var/log/sa/sa10 -s 07:00:00 -e 15:00:00
This command will display the CPU utilization on the 10th day of the current month, from 7:00 to 15:00 hrs.
Monitoring Memory Utilization:
# sar -r 2 10
This command will display memory utilization for every 2 seconds, up to 10 times.
Checking Memory Utilization on a Specific Day:
# sar -r -f /var/log/sa/sa14
This command will display the memory utilization on the 14th day of the current month.
Checking Memory Utilization During Specific Time Frame:
# sar -r -f /var/log/sa/sa10 -s 07:00:00 -e 15:00:00
This command will display the memory utilization on the 10th day of the current month, from 7:00 to 15:00 hrs.
Monitoring Swap Utilization:
# sar -S 2 10
This command will display swap utilization for every 2 seconds, up to 10 times.
Checking Swap Utilization on a Specific Day:
# sar -S -f /var/log/sa/sa25
This command will display the swap utilization on the 25th day of the current month.
Checking Swap Utilization During Specific Time Frame:
# sar -S -f /var/log/sa/sa10 -s 07:00:00 -e 15:00:00
This command will display the swap utilization on the 10th day of the current month, from 7:00 to 15:00 hrs.
Monitoring Load Average:
# sar -q 2 10
This command will display the load average for every 2 seconds, up to 10 times.
Checking Load Average on a Specific Day:
# sar -q -f /var/log/sa/sa14
This command will display the load average on the 14th day of the current month.
Checking Load Average During Specific Time Frame:
# sar -q -f /var/log/sa/sa10 -s 07:00:00 -e 15:00:00
This command will display the load average on the 10th day of the current month, from 7:00 to 15:00 hrs.
Monitoring Paging Information:
# sar -B 2 10
This command will display the paging information for every 2 seconds upto 10 times.
Monitoring Disk Usage:
# sar -d 2 10
This command will display disk usage for every 2 seconds, up to 10 times.
Monitoring Power Management:
# sar -m 2 10
This command will display power management information for every 2 seconds, up to 10 times.
Monitoring Disk Input and Output Statistics:
# sar -b 2 10
This command will display disk input and output statistics for every 2 seconds, up to 10 times.
1 Comment
You actually make it appear so easy together with your
presentation however I to find this matter to be really something
that I think I might by no means understand.
It kind of feels too complicated and extremely vast for me.
I’m taking a look ahead on your subsequent put up, I’ll
try to get the dangle of it!