sar_commands
This is an old revision of the document!
Common Sar Commands
Show all statistics for current day:
1 |
sar -<option> |
1 |
sar -<option> 1 3 |
Show CPU statistics 3 times with 1 second interval, (focus on the last field “%idle” to see the cpu load):
1 |
sar 1 3 |
CPU usage of ALL CPUs
1 |
sar -u 1 3 |
Load average
1 |
sar -q |
Swap Space
1 |
sar -S |
Viewing specific time and date
Select a specific time during the day:
1 |
sar -<option> -s 10:30:00 |
1 |
sar -q -f /var/log/sa/sa23 -s 10:00:01 |
1 |
sar -p | grep -A5 "07:45" |
Finding every occurrence the load increased above the recommended amount
Change the value 4 to the number of CPUs you have
1 |
sar -q | awk '$5 > 4' |
Summary of logs
RAM
1 |
for i in $( ls - tr /var/log/sa/sa [0-9][0-9]); do echo $( ls -l $i); sar -r -f $i | awk '$4 > 98.8' ; done |
CPU
1 |
for i in $( ls - tr /var/log/sa/sa [0-9][0-9]); do echo $( ls -l $i); sar -u -f $i | awk '$8 > 20' ; done |
load
1 |
for i in $( ls - tr /var/log/sa/sa [0-9][0-9]); do echo $( ls -l $i); sar -q -f $i | awk '$5 > 1' ; done |
sar_commands.1461914581.txt.gz · Last modified: 2024/05/23 07:26 (external edit)