Difference between revisions of "Sar (sysstat)"
(New page: In computing, <code>`sar`</code> (System Activity Report) is a Solaris-derived system monitor command used to report on various system loads, including CPU activity, memory/paging, device ...) |
|||
Line 12: | Line 12: | ||
The statistics reported by <code>`sar`</code> deal with I/O transfer rates, paging activity, process-related activities, interrupts, network activity, memory and swap space utilization, CPU utilization, kernel activities, and TTY statistics, among others. Both UP and SMP machines are fully supported. | The statistics reported by <code>`sar`</code> deal with I/O transfer rates, paging activity, process-related activities, interrupts, network activity, memory and swap space utilization, CPU utilization, kernel activities, and TTY statistics, among others. Both UP and SMP machines are fully supported. | ||
+ | |||
+ | ==Example usage== | ||
+ | * CPU usage for all CPU cores on your machine | ||
+ | |||
+ | This gives the cumulative real-time CPU usage of all CPUs on your machine. "<code>1 3</code>" reports for every 1 seconds a total of 3 times. The most useful column/field in this report is "<code>%idle</code>" for the CPU load: | ||
+ | <pre> | ||
+ | $ sar -u 1 3 | ||
+ | Linux 3.8.0-30 (foobar) 11/09/13 _x86_64_ (4 CPU) | ||
+ | |||
+ | 17:12:06 CPU %user %nice %system %iowait %steal %idle | ||
+ | 17:12:07 all 7.93 0.00 4.35 0.00 0.26 87.47 | ||
+ | 17:12:08 all 13.04 0.00 4.35 0.00 0.51 82.10 | ||
+ | 17:12:09 all 11.70 0.00 4.83 0.00 0.00 83.46 | ||
+ | Average: all 10.89 0.00 4.51 0.00 0.26 84.34 | ||
+ | </pre> | ||
+ | |||
+ | * CPU usage for all CPU core on your machine with extended output: | ||
+ | <pre> | ||
+ | $ sar -u ALL 1 3 | ||
+ | Linux 3.8.0-30 (foobar) 11/09/13 _x86_64_ (4 CPU) | ||
+ | |||
+ | 17:16:04 CPU %usr %nice %sys %iowait %steal %irq %soft %guest %idle | ||
+ | 17:16:05 all 7.87 0.00 3.30 0.00 0.25 0.00 0.00 0.00 88.58 | ||
+ | 17:16:06 all 7.75 0.00 3.88 0.00 0.26 0.00 0.00 0.00 88.11 | ||
+ | 17:16:07 all 8.46 0.00 4.87 0.00 0.26 0.00 0.00 0.00 86.41 | ||
+ | Average: all 8.03 0.00 4.01 0.00 0.26 0.00 0.00 0.00 87.70 | ||
+ | </pre> | ||
+ | |||
+ | * CPU usage for second day of the month (Note: On some distros, the location of the <code>`sar`</code> logs is stored under <code>/var/log/sa/</code>): | ||
+ | sar -u -f /var/log/sysstat/sa02 | ||
==External links== | ==External links== |
Revision as of 23:13, 9 November 2013
In computing, `sar`
(System Activity Report) is a Solaris-derived system monitor command used to report on various system loads, including CPU activity, memory/paging, device load, network, etc. Linux distributions provide `sar`
through the sysstat
package.
Utilities
The sysstat package contains the following system performance tools:
sar
- collects and reports system activity information
iostat
- reports CPU utilization and disk I/O statistics
mpstat
- reports global and per-processor statistics
pidstat
- reports statistics for Linux tasks (processes)
sadf
- displays data collected by sar in various formats
nfsiostat
- reports I/O statistics for network filesystems
cifsiostat
- reports I/O statistics for CIFS filesystems
The statistics reported by `sar`
deal with I/O transfer rates, paging activity, process-related activities, interrupts, network activity, memory and swap space utilization, CPU utilization, kernel activities, and TTY statistics, among others. Both UP and SMP machines are fully supported.
Example usage
- CPU usage for all CPU cores on your machine
This gives the cumulative real-time CPU usage of all CPUs on your machine. "1 3
" reports for every 1 seconds a total of 3 times. The most useful column/field in this report is "%idle
" for the CPU load:
$ sar -u 1 3 Linux 3.8.0-30 (foobar) 11/09/13 _x86_64_ (4 CPU) 17:12:06 CPU %user %nice %system %iowait %steal %idle 17:12:07 all 7.93 0.00 4.35 0.00 0.26 87.47 17:12:08 all 13.04 0.00 4.35 0.00 0.51 82.10 17:12:09 all 11.70 0.00 4.83 0.00 0.00 83.46 Average: all 10.89 0.00 4.51 0.00 0.26 84.34
- CPU usage for all CPU core on your machine with extended output:
$ sar -u ALL 1 3 Linux 3.8.0-30 (foobar) 11/09/13 _x86_64_ (4 CPU) 17:16:04 CPU %usr %nice %sys %iowait %steal %irq %soft %guest %idle 17:16:05 all 7.87 0.00 3.30 0.00 0.25 0.00 0.00 0.00 88.58 17:16:06 all 7.75 0.00 3.88 0.00 0.26 0.00 0.00 0.00 88.11 17:16:07 all 8.46 0.00 4.87 0.00 0.26 0.00 0.00 0.00 86.41 Average: all 8.03 0.00 4.01 0.00 0.26 0.00 0.00 0.00 87.70
- CPU usage for second day of the month (Note: On some distros, the location of the
`sar`
logs is stored under/var/log/sa/
):
sar -u -f /var/log/sysstat/sa02