Using Sar To Monitor System Performance

The sar utility, which is part of the systat package, can be used to review history performance data on your server. System resource utilization can be seen for given time frames to help troubleshoot performance issues, or to optimize performance.

Installation Sar

Sysstat can be easilly installed using the yum package manager:

yum install sysstat

The installation includes a cron task, located at /etc/cron.d/sysstat, which collects system performance information every ten minutes. This polling interval can be changed simply by modifying the cron task.

Usage

After some time for the cron task to begin collecting data, the sar command can be used to display collected information. Executing the command without arguments will provide system load information on the current day.

# sar

The -s (for start) and -e (for end) flags can be used to narrow the displayed information to a specific timeframe.

# sar -s 02:30:00 -e 04:00:00

For previous days, you’ll need to specify the -f flag, along with a path to that days stat file; which are located under /var/log/sa/. To see data for the 9th, you would use the sa09 file.

# sar -f /var/log/sa/sai09

Live information can be collected and displayed by specifying the interval of collection, and the number of times to collect; sar interval run_times seconds, 10 times, run:

sar 5 10

Additional flags can be passed to sar to display other collected data.

FLAG                 EXAMPLE

Memory: -r        sar -r
Disk: -d              sar -d
Processor: -P    sar -P 0 -P 1
sar -P ALL
Network: -n      sar -n DEV

[box type=”info” align=”aligncenter” ]Refer to the sar man page for further information.[/box]

Leave a Comment