sar is another UNIX command for gathering information about activities on your system. You can gather data over an extended time period with sar and later produce reports based on the data. sar is similar among UNIX variants in that the options and outputs are similar. The Linux system I was using for the examples did not support sar , but the Solaris, HP-UX, and AIX systems had the same options and nearly identical outputs. The following are some useful options to sar, along with examples of reports produced with these options where applicable : sar -o | Saves data in a file specified by "o." After the file name , you would usually also enter the time interval for samples and the number of samples. The following example shows saving the binary data in file /tmp/sar.data at an interval of 60 seconds 300 times: | | # sar -o /tmp/sar.data 60 300 | | The data in /tmp/sar.data can later be extracted from the file. | sar -f | Specify a file from which you will extract data. | sar -u | Report CPU utilization with the headings %usr, %sys, %wio, %idle with some processes waiting for block I/O, %idle. This report is similar to the iostat and vmstat CPU reports. You extract the binary data saved in a file to get CPU information, as shown in the following example. The following is a sar -u example: | # sar -u -f /tmp/sar.data | Header Information for your system 12:52:04 %usr %sys %wio %idle 12:53:04 62 4 5 29 12:54:04 88 5 3 4 12:55:04 94 5 1 0 12:56:04 67 4 4 25 12:57:04 59 4 4 32 12:58:04 61 4 3 32 12:59:04 65 4 3 28 13:00:04 62 5 16 17 13:01:04 59 5 9 27 13:02:04 71 4 3 22 13:03:04 60 4 4 32 13:04:04 71 5 4 20 13:05:04 80 6 8 7 13:06:04 56 3 3 37 13:07:04 57 4 4 36 13:08:04 66 4 4 26 13:09:04 80 10 2 8 13:10:04 73 10 2 15 13:11:04 64 6 3 28 13:12:04 56 4 3 38 13:13:04 55 3 3 38 13:14:04 57 4 3 36 13:15:04 70 4 5 21 13:16:04 65 5 9 21 13:17:04 62 6 2 30 13:18:04 60 5 3 33 13:19:04 77 3 4 16 13:20:04 76 5 3 15 . . . 14:30:04 50 6 6 38 14:31:04 57 12 19 12 14:32:04 51 8 20 21 14:33:04 41 4 9 46 14:34:04 43 4 9 45 14:35:04 38 4 6 53 14:36:04 38 9 7 46 14:37:04 46 3 11 40 14:38:04 43 4 7 46 14:39:04 37 4 5 54 14:40:04 33 4 5 58 14:41:04 40 3 3 53 14:42:04 44 3 3 50 14:43:04 27 3 7 64 Average 57 5 8 30 sar -b | Report buffer cache activity. A database application such as Oracle would recommend that you use this option to see the effectiveness of buffer cache use. You extract the binary data saved in a file to get CPU information, as shown in the following example: | # sar -b -f /tmp/sar.data Header information for your system 12:52:04 bread/s lread/s %rcache bwrit/s lwrit/s %wcache pread/s pwrit/s 12:53:04 5 608 99 1 11 95 0 0 12:54:04 7 759 99 0 14 99 0 0 12:55:04 2 1733 100 4 24 83 0 0 12:56:04 1 836 100 1 18 96 0 0 12:57:04 0 623 100 2 21 92 0 0 12:58:04 0 779 100 1 16 96 0 0 12:59:04 0 1125 100 0 14 98 0 0 13:00:04 2 1144 100 9 89 89 0 0 13:01:04 10 898 99 11 76 86 0 0 13:02:04 0 1156 100 0 14 99 0 0 13:03:04 1 578 100 2 22 88 0 0 13:04:04 5 1251 100 0 12 99 0 0 13:05:04 3 1250 100 0 12 97 0 0 13:06:04 1 588 100 0 12 98 0 0 13:07:04 1 649 100 2 15 86 0 0 13:08:04 1 704 100 2 15 86 0 0 13:09:04 1 1068 100 0 18 100 0 0 13:10:04 0 737 100 1 44 99 0 0 13:11:04 0 735 100 1 13 95 0 0 13:12:04 0 589 100 1 15 93 0 0 13:13:04 0 573 100 0 16 99 0 0 13:14:04 1 756 100 1 16 91 0 0 13:15:04 1 1092 100 9 49 81 0 0 13:16:04 2 808 100 6 82 93 0 0 13:17:04 0 712 100 1 9 93 0 0 13:18:04 1 609 100 0 13 97 0 0 13:19:04 1 603 100 0 10 99 0 0 13:20:04 0 1127 100 0 14 98 0 0 . . . 14:30:04 2 542 100 1 22 94 0 0 14:31:04 10 852 99 12 137 92 0 0 14:32:04 2 730 100 10 190 95 0 0 14:33:04 4 568 99 2 26 91 0 0 14:34:04 4 603 99 1 13 91 0 0 14:35:04 1 458 100 1 13 89 0 0 14:36:04 13 640 98 1 24 98 0 0 14:37:04 21 882 98 1 18 95 0 0 14:38:04 7 954 99 0 19 98 0 0 14:39:04 3 620 100 1 11 94 0 0 14:40:04 3 480 99 2 15 85 0 0 14:41:04 1 507 100 0 9 98 0 0 14:42:04 1 1010 100 1 10 91 0 0 14:43:04 5 547 99 1 9 93 0 0 Average 3 782 100 3 37 91 0 0 sar -d | Report disk activity. You get the device name, percent that the device was busy, average number of requests outstanding for the device, number of data transfers per second for the device, and other information. You extract the binary data saved in a file to get CPU information, as shown in the following example: | # sar -d -f /tmp/sar.data Header information for your system 12:52:04 device %busy avque r+w/s blks/s avwait avserv 12:53:04 c0t6d0 0.95 1.41 1 10 16.76 17.28 c5t4d0 100.00 1.03 20 320 8.36 18.90 c4t5d1 10.77 0.50 13 214 5.02 18.44 c5t4d2 0.38 0.50 0 3 4.61 18.81 12:54:04 c0t6d0 0.97 1.08 1 11 10.75 14.82 c5t4d0 100.00 1.28 54 862 9.31 20.06 c4t5d1 12.43 0.50 15 241 5.21 16.97 c5t4d2 0.37 0.50 0 3 3.91 18.20 12:55:04 c0t6d0 1.77 1.42 1 22 13.32 14.16 c5t4d0 100.00 0.79 26 421 8.33 16.00 c4t5d1 14.47 0.51 17 270 5.30 13.48 c5t4d2 0.72 0.50 0 7 4.82 15.69 12:56:04 c0t6d0 1.07 21.57 1 22 72.94 19.58 c5t4d0 100.00 0.60 16 251 6.80 13.45 c4t5d1 8.75 0.50 11 177 5.05 10.61 c5t4d2 0.62 0.50 0 6 4.79 15.43 12:57:04 c0t6d0 0.78 1.16 1 9 13.53 14.91 c5t4d0 100.00 0.66 15 237 7.60 13.69 c4t5d1 9.48 0.54 13 210 5.39 13.33 c5t4d2 0.87 0.50 1 10 4.86 14.09 12:58:04 c0t6d0 1.12 8.29 1 17 54.96 14.35 c5t4d0 100.00 0.60 11 176 7.91 14.65 c4t5d1 5.35 0.50 7 111 5.23 10.35 c5t4d2 0.92 0.50 1 10 4.63 16.08 12:59:04 c0t6d0 0.67 1.53 1 8 18.03 16.05 c5t4d0 99.98 0.54 11 174 7.69 14.09 c4t5d1 3.97 0.50 5 83 4.82 9.54 c5t4d2 1.05 0.50 1 11 4.69 16.29 13:00:04 c0t6d0 3.22 0.67 3 39 8.49 16.53 c5t4d0 100.00 0.60 65 1032 8.46 14.83 c4t5d1 21.62 0.50 31 504 5.30 8.94 c5t4d2 6.77 0.50 5 78 4.86 14.09 13:01:04 c0t6d0 4.45 3.08 5 59 25.83 11.49 c5t4d0 100.00 0.65 42 676 7.85 14.52 c4t5d1 21.34 0.55 30 476 5.87 18.49 c5t4d2 4.37 0.50 3 51 5.32 13.50 . . . 14:42:04 c0t6d0 0.53 0.83 0 7 12.21 16.33 c5t4d0 100.00 0.56 7 107 6.99 14.65 c4t5d1 6.38 0.50 7 113 4.97 15.18 c5t4d2 0.15 0.50 0 2 4.53 16.50 14:43:04 c0t6d0 0.52 0.92 0 7 11.50 15.86 c5t4d0 99.98 0.92 17 270 8.28 18.64 c4t5d1 10.26 0.50 9 150 5.35 16.41 c5t4d2 0.12 0.50 0 1 5.25 14.45 Average c0t6d0 1.43 108.80 2 26 0.00 14.71 Average c5t4d0 100.00 0.74 25 398 7.83 -10.31 Average c4t5d1 19.11 0.51 25 399 5.26 -13.75 Average c5t4d2 1.71 0.53 1 21 5.29 13.46 sar -q | Report average queue length. You may have a problem any time the run queue length is greater than the number of processors on the system: | # sar -q -f /tmp/sar.data Header information for your system 12:52:04 runq-sz %runocc swpq-sz %swpocc 12:53:04 1.1 20 0.0 0 12:54:04 1.4 51 0.0 0 12:55:04 1.3 71 0.0 0 12:56:04 1.1 22 0.0 0 12:57:04 1.3 16 0.0 0 12:58:04 1.1 14 0.0 0 12:59:04 1.2 12 0.0 0 13:00:04 1.2 21 0.0 0 13:01:04 1.1 18 0.0 0 13:02:04 1.3 20 0.0 0 13:03:04 1.2 15 0.0 0 13:04:04 1.2 20 0.0 0 13:05:04 1.2 43 0.0 0 13:06:04 1.1 14 0.0 0 13:07:04 1.2 15 0.0 0 13:08:04 1.2 26 0.0 0 13:09:04 1.5 38 0.0 0 13:10:04 1.5 30 0.0 0 13:11:04 1.2 23 0.0 0 13:12:04 1.3 11 0.0 0 13:13:04 1.3 12 0.0 0 13:14:04 1.4 16 0.0 0 13:15:04 1.4 27 0.0 0 13:16:04 1.5 20 0.0 0 13:17:04 1.3 21 0.0 0 13:18:04 1.1 15 0.0 0 13:19:04 1.2 19 0.0 0 13:20:04 1.4 22 0.0 0 . . . 14:30:04 1.5 5 0.0 0 14:31:04 1.6 12 0.0 0 14:32:04 1.4 9 0.0 0 14:33:04 1.1 6 0.0 0 14:34:04 1.3 3 0.0 0 14:35:04 1.1 4 0.0 0 14:36:04 1.2 6 0.0 0 14:37:04 1.4 5 0.0 0 14:38:04 1.2 10 0.0 0 14:39:04 1.3 4 0.0 0 14:40:04 1.1 3 0.0 0 14:41:04 1.6 3 0.0 0 14:42:04 1.1 4 0.0 0 14:43:04 1.3 1 0.0 0 Average 1.3 17 1.2 0 sar -w | Report system swapping activity. | # sar -w -f /tmp/sar.data Header information for your system 12:52:04 swpin/s bswin/s swpot/s bswot/s pswch/s 12:53:04 1.00 0.0 1.00 0.0 231 12:54:04 1.00 0.0 1.00 0.0 354 12:55:04 1.00 0.0 1.00 0.0 348 12:56:04 1.00 0.0 1.00 0.0 200 12:57:04 1.00 0.0 1.00 0.0 277 12:58:04 1.00 0.0 1.00 0.0 235 12:59:04 1.02 0.0 1.02 0.0 199 13:00:04 0.78 0.0 0.78 0.0 456 13:01:04 1.00 0.0 1.00 0.0 435 13:02:04 1.02 0.0 1.02 0.0 216 13:03:04 0.98 0.0 0.98 0.0 204 13:04:04 1.02 0.0 1.02 0.0 239 13:05:04 1.00 0.0 1.00 0.0 248 13:06:04 0.97 0.0 0.97 0.0 170 13:07:04 1.00 0.0 1.00 0.0 166 13:08:04 1.02 0.0 1.02 0.0 209 13:09:04 0.98 0.0 0.98 0.0 377 13:10:04 1.00 0.0 1.00 0.0 200 13:11:04 1.00 0.0 1.00 0.0 192 13:12:04 0.87 0.0 0.87 0.0 187 13:13:04 0.93 0.0 0.93 0.0 172 13:14:04 1.00 0.0 1.00 0.0 170 13:15:04 1.00 0.0 1.00 0.0 382 13:16:04 1.00 0.0 1.00 0.0 513 13:17:04 1.00 0.0 1.00 0.0 332 13:18:04 1.00 0.0 1.00 0.0 265 13:19:04 1.02 0.0 1.02 0.0 184 13:20:04 0.98 0.0 0.98 0.0 212 . . . 14:30:04 0.00 0.0 0.00 0.0 301 14:31:04 0.00 0.0 0.00 0.0 566 14:32:04 0.00 0.0 0.00 0.0 539 14:33:04 0.00 0.0 0.00 0.0 400 14:34:04 0.00 0.0 0.00 0.0 242 14:35:04 0.00 0.0 0.00 0.0 286 14:36:04 0.00 0.0 0.00 0.0 295 14:37:04 0.00 0.0 0.00 0.0 249 14:38:04 0.00 0.0 0.00 0.0 300 14:39:04 0.00 0.0 0.00 0.0 296 14:40:04 0.00 0.0 0.00 0.0 419 14:41:04 0.00 0.0 0.00 0.0 234 14:42:04 0.00 0.0 0.00 0.0 237 14:43:04 0.00 0.0 0.00 0.0 208 Average 0.70 0.0 0.70 0.0 346 |