How do I configure sar to collect disk information (ala -d)?

The sysstat service which runs the sa binaries is not collecting disk statistics in /var/log/sa files. This is turned off by default to prevent the logs from growing large on systems with hundreds or thousands of block devices.

When you run sar to report disk statistics, the Requested activities not available in file message is telling you that sa hasn't been collecting disk statistics, so sar can't display anything.

You can add config parameters with the SADC_OPTIONS value in /etc/sysconfig/sysstat

The ability to do this was added in Bug 598794 so you'll need to be running sysstat-7.0.2-11.el5 or later.

Edit your /etc/sysconfig/sysstat file to include a line like:

SADC_OPTIONS="-d" 

then service sysstat restart

Give it some time for data to collect (at least 20 minutes), then sar -d should work.

answered May 15, 2013 at 13:44 781 6 6 silver badges 13 13 bronze badges

Actually the SADC_OPTIONS are quite different from the command-line options to "sar". The above example of using -d for SADC_OPTIONS is incorrect. Read "man sadc" and note that by default, sadc collects a lot of stuff. The extra options add additional areas of statistics to gather, by type.

Commented Nov 2, 2015 at 22:11

Read the man page on sadc to learn what the various options do in the config file for sysstat . You should see something like:

-S < INT | DISK | SNMP | IPV6 | POWER | XDISK | ALL | XALL >Specify which optional activities should be collected by sadc. 

The default in CentOS 6 and CentOS 7 is -S DISK , but e.g. I have replaced that with -S SNMP on a box responsible for network monitoring. You can use multiples like this: -S DISK -S POWER -S INT .

Note that you get many statistics by default with sadc . The -S options just add more.

Try something like this to learn how sadc and sar are related:

# /usr/lib64/sa/sadc -S INT -S DISK 10 10 /tmp/test (. wait 10 * 10 = 100 seconds . ) # sar -f /tmp/test | head Linux 3.10.0-123.20.1.el7.x86_64 (icinga02.foo) 11/02/15 _x86_64_ (4 CPU) 15:17:41 CPU %user %nice %system %iowait %steal %idle 15:17:51 all 13.94 0.00 2.48 0.03 0.00 83.55 15:18:01 all 14.71 0.00 2.46 0.00 0.00 82.83 15:18:11 all 17.72 0.00 1.88 0.00 0.00 80.40 15:18:21 all 11.47 0.00 1.30 0.00 0.00 87.22 15:18:31 all 18.43 0.00 1.98 0.00 0.00 79.59 

Note you can extract many other stats from that file now, like load instead of cpu :

# sar -q -f /tmp/test | head Linux 3.10.0-123.20.1.el7.x86_64 (icinga02.foo) 11/02/15 _x86_64_ (4 CPU) 14:20:01 runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 14:30:01 0 239 0.64 0.54 0.50 0 14:40:01 0 240 1.10 1.01 0.74 0 14:50:01 0 242 0.98 0.97 0.84 0 15:00:01 0 243 1.14 0.94 0.88 0 15:10:01 0 242 0.63 0.74 0.82 0 15:20:01 1 244 0.60 0.57 0.68 0 Average: 0 242 0.85 0.80 0.74 0