Question
How do you diagnose high loads with the sar command?
Answer
Historical resource usage and load averages can be viewed using the sar utility, which should exist by default on all cPanel servers from the sysstat package. The stats are collected when sysstat runs from cron (/etc/cron.d/sysstat). If the crond service is not running, sysstat will not be able to collect historical statistics.
To view resource usage history from sar, you can provide the path to the file that corresponds to the date of the stats.
For example, if you wanted to view the load averages for your server from the 25th of the month, you would run this command:
# sar -q -f /var/log/sa/sa25
The command above uses the -q flag to specify that load average information is wanted, and the -f flag to specify which sar file (day of the month) to read the data from.
Note: sar may not have historical data for every day of the month.
If you do not provide the day in the sar command, it will provide metrics for today. For example, the command below would show the load average for today:
# sar -q
Some commonly needed metrics and their sar commands are provided below.
-
Check CPU usage:
# sar
-
Check memory usage:
# sar -r
-
Check disk usage:
# sar -dp
-
Check load Averages:
# sar -q
To help determine the source of the load, compare the times when the load averages are elevated against the other metrics. For example, if the commit percentage listed in sar -r is significantly higher than 100%, this indicates that the server was running out of memory at that time.
The following command will display the manual for the sar command. It will contain information on the flags and their usage.
# man sar
Warning: Server load investigations may require the assistance of a qualified System Administrator. If you do not have a System Administrator, we provide a listing of System Administrators here:
System Administration Services
Comments
0 comments
Article is closed for comments.