User Tools

Site Tools


Couldn't load sqlite.
Couldn't load sqlite.

sar

Sar is part of Sysstat, a collection of performance monitoring tools for Linux.

Usage

Run sar 2 where interval in seconds measurements will taken shown at. sar outputs a variety of performance data. See the man page for information on all of the available diagnostics. For monitoring I/O you may use the -b or -d flags to view I/O transfer rates or block device activity respectively.

The feature that sets sar apart from tools like iotop is it's logging capability. Once logging is set up you may use sar -A to view all information in the current days logfile or use -f to specify a specific logfile you want to examine.

Logging Setup

To make use of sar you first need to enable logging. When building from source make install –enable-install-cron can be used to enable logging via cron. When installing a package, depending on your distribution, logging might be enabled by default or you may have to use either your init-system or create a cron-job to activate it. For details view the sysstat-documentation or the relevant documentation for your distribution.

Output

The default output when running sar looks like this:

Linux 4.4.3-1-ARCH (your-hostname) 	03/10/2016 	_x86_64_	(8 CPU)

02:52:49 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
02:52:51 PM     all      8.02      0.00      1.13      0.00      0.00     90.86
02:52:53 PM     all      8.57      0.00      0.69      0.06      0.00     90.68
02:52:55 PM     all      8.43      0.00      1.00      0.00      0.00     90.57
02:52:57 PM     all      7.66      0.00      0.69      0.00      0.00     91.65

sar -bd 2 results in this output:

Linux 4.4.3-1-ARCH (your-hostname) 	03/10/2016 	_x86_64_	(8 CPU)

03:25:29 PM       tps      rtps      wtps   bread/s   bwrtn/s
03:25:31 PM     59.00      0.00     59.00      0.00  47068.00

03:25:29 PM       DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz  avgqu-sz     await     svctm     %util
03:25:31 PM    dev8-0     59.00      0.00  47068.00    797.76      2.24     37.91      0.76      4.50
03:25:31 PM   dev8-32      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
03:25:31 PM   dev8-16      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

03:25:31 PM       tps      rtps      wtps   bread/s   bwrtn/s
03:25:33 PM      1.00      0.00      1.00      0.00     52.00

03:25:31 PM       DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz  avgqu-sz     await     svctm     %util
03:25:33 PM    dev8-0      1.00      0.00     52.00     52.00      0.00      0.00      0.00      0.00
03:25:33 PM   dev8-32      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
03:25:33 PM   dev8-16      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

Similar tools