]> granicus.if.org Git - sysstat/blob - FAQ
NLS: Sync with translation project
[sysstat] / FAQ
1 This is sysstat's Frequently Asked Questions!
2 Be sure to read this carefully before asking for help...
3 If you don't find the solution to your problem here then send me an email
4 (please remember to include the version numbers of sysstat and of your kernel).
5
6
7 1. GENERAL QUESTIONS
8
9 1.1. When I compile sysstat, it fails with the following message:
10      "make: msgfmt: Command not found".
11 1.2. When I try to compile sysstat, it fails and says it cannot find some
12      include files.
13 1.3. I don't understand why sysstat displays the time sometimes as HH:MM:SS
14      and sometimes as HH:MM:SS AM/PM...
15      
16 2. QUESTIONS RELATING TO SAR/SADC/SADF
17
18 2.1. The sar command complains with the following message:
19      "Invalid system activity file: ...".
20 2.2. The sar command complains with the following message:
21      "Cannot append data to that file (...)".
22 2.3. The sar command complains with the following message:
23      "Inconsistent input data".
24 2.4. I get the following error message when I try to run sar:
25      "Cannot open /var/log/sa/sa30: No such file or directory".
26 2.5. Are sar daily data files fully compatible with Sun Solaris format
27      sar files?
28 2.6. I have some trouble running sar on my SMP box. My server crashes
29      with a kernel oops.
30 2.7. The "Average:" results from the sar command are just rubbish...
31 2.8. My database (e.g. MySQL) doesn't appear to understand the time zone
32      displayed by 'sadf -d'...
33 2.9. I tried to use options -s and -e with sadf. Unfortunately, I have
34      nothing displayed at all.
35 2.10. I cannot see all my disks when I use the sar -d command...
36 2.11. Do you know a tool which can graphically plot the data collected by sar?
37 2.12. When I launch sadc, I get the error message:
38       "flock: Resource temporarily unavailable".
39 2.13. How should I run sysstat / sar so that I get a reading for 00:00:00?
40 2.14. The sar command complains with the following message:
41       "Requested activities not available in file ...".
42 2.15. Does sar need a lot of resources to run?
43 2.16. Are the measurements gathered by sadc cumulative or instantaneous?
44 2.17. Some fields are always displayed as 0.00 when I use the sar -d
45       command.
46 2.18. The sar command complains with the following message:
47       "Requested activities not available".
48 2.19. How can I keep sar data for more than one month?
49 2.20. How can I load sar data into an Oracle database for performance
50       analysis and capacity planning?
51 2.21. The sar command displays some weird output values...
52 2.22. What happened to sar's options -h, -H, -x and -X?
53 2.23. What is the exact meaning of the <count> parameter for sar and sadc?
54 2.24. Why doesn't sar deal with sub-second sampling/monitoring?
55 2.25. Is it possible to save only some specific activities in my daily
56       data files? It would help to make saXX files take less space on disk...
57
58
59 3. QUESTIONS RELATING TO IOSTAT
60
61 3.1. I can't see all my disks when I use the iostat command...
62 3.2. iostat -x doesn't report disk I/O statistics...
63 3.3. Why can't iostat display extended statistics for partitions with
64      2.6.x kernels?
65 3.4. I don't understand the output of iostat. It doesn't match what I expect
66      it to be...
67 3.5. Why values displayed by iostat are so different in the first report
68      from those displayed in subsequent ones?
69 3.6. iostat -x displays huge numbers for some fields...
70
71 4. QUESTIONS RELATING TO PIDSTAT
72
73 4.1. pidstat -d doesn't report task I/O statistics...
74 4.2. The pidstat command complains with the following message:
75       "Requested activities not available".
76 4.3. pidstat doesn't display statistics for process (task) xyz...
77 4.4. I noticed that the total CPU utilization for threads running on
78      an individual CPU can exceed 100%...
79
80
81 1. GENERAL QUESTIONS
82 ####################
83
84 1.1. When I compile sysstat, it fails with the following message:
85 make: msgfmt: Command not found
86 make: ***[locales] Error 127
87
88 The msgfmt command belongs to the GNU gettext package.
89 If you don't have it on your system, just configure sysstat with
90 NLS disabled like this:
91
92 $ ./configure --disable-nls
93
94 or answer 'y' (for "yes") to the question
95 "Disable National Language Support (NLS)? (y/n) [--disable-nls]"
96 if you use the Interactive Configuration script (iconfig),
97 then compile sysstat as usual (make ; make install).
98 Please read the README-nls file included in sysstat source package to learn
99 some more about National Language Support.
100
101 ~~~
102
103 1.2. When I try to compile sysstat, it fails and says it cannot find some
104 include files:
105 In file included from /usr/include/bits/errno.h:25,
106                  from /usr/include/errno.h:36,
107                  from common.c:26:
108 /usr/include/linux/errno.h:4: asm/errno.h: No such file or directory
109 <SNIP>
110 common.c: In function `get_kb_shift':
111 common.c:180: `PAGE_SIZE' undeclared (first use in this function)
112 common.c:178: warning: `size' might be used uninitialized in this function
113 make: *** [common.o] Error 1
114
115 Make sure that you have the Linux kernel sources installed in
116 /usr/src/linux. Also make sure that the symbolic link exists in the
117 /usr/src/linux/include directory and points to the right architecture, e.g.:
118
119 # ll /usr/src/linux/include/asm
120 lrwxrwxrwx   1 root     root            8 May  5 18:31 /usr/src/linux/include/asm -> asm-i386
121
122 In fact, only the Linux kernel headers should be necessary to be able
123 to compile sysstat.
124
125 ~~~
126
127 1.3. I don't understand why sysstat displays the time sometimes as HH:MM:SS
128 and sometimes as HH:MM:SS AM/PM...
129
130 The time format used by sysstat tools depends on the locale of your system.
131 The locale is defined by several environment variables, among which the LANG
132 variable is perhaps the most widely used. See the following example:
133
134 $ export LANG=en_US
135 $ sar
136 Linux 2.4.9 (brooks.seringas.fr)        07/20/04
137
138 04:32:11 PM       LINUX RESTART
139
140 05:00:00 PM       CPU     %user     %nice   %system   %iowait     %idle
141 05:10:00 PM       all      0.24      0.00     89.64      0.00     10.12
142 Average:          all      0.24      0.00     89.64      0.00     10.12
143
144 $ export LANG=fr_FR
145 $ sar
146 Linux 2.4.9 (brooks.seringas.fr)        20.07.2004
147
148 16:32:11          LINUX RESTART
149
150 17:00:00          CPU     %user     %nice   %system   %iowait     %idle
151 17:10:00          all      0,24      0,00     89,64      0,00     10,12
152 Moyenne:          all      0,24      0,00     89,64      0,00     10,12
153
154 As you can notice, the time format but also the date, the decimal point, and
155 even some words (like "Average") have changed according to the specified
156 locale.
157
158
159 2. QUESTIONS RELATING TO SAR/SADC/SADF
160 ######################################
161
162 2.1. The sar command complains with the following message:
163 Invalid system activity file: ...
164
165 You are trying to use a file which is not a system activity file, or
166 whose format is no longer compatible with that of files created by
167 current version of sar.
168 If you were trying to use the standard system activity files located in the
169 /var/log/sa directory then the solution is easy: just log in as root and
170 remove by hand all the files located in the /var/log/sa directory:
171
172 # rm /var/log/sa/sa??
173
174 If you are using sysstat 11.1.1 and later, you can also use the sadf command
175 to convert an old system activity binary datafile (version 9.1.6 and later) to
176 current up-to-date format. Use the following syntax:
177
178 $ sadf -c old_datafile > new_datafile
179
180 Note: Starting with sysstat version 8.1.1 and later, it is possible to
181 know which version of sar or sadc has been used to create a data file.
182 Just enter the following command:
183
184 $ sadf -H /your/datafile | grep sysstat
185 File created using sar/sadc from sysstat version 8.1.7
186
187 ~~~
188
189 2.2. The sar command complains with the following message:
190 Cannot append data to that file (...)
191
192 The internal structure of the data file does not allow sar to append
193 data to it. The data file may come from another machine, or the components
194 of the current box, such as the number of processors, may have changed.
195 Use another data file, or delete the current daily data file, and try again.
196 With sysstat version 10.1.3 and later, it is now possible to append data
197 to a data file even if the number of processors has changed. But first,
198 you have to make the data file aware of this change by inserting a restart
199 mark (this is typically done when sadc is called at system restart). You
200 can then append data to the data file as usual. 
201
202 ~~~
203
204 2.3. The sar command complains with the following message:
205 Inconsistent input data
206
207 This error message means that sadc (the system activity data collector that
208 sar is using) is not consistent with the sar command. In most cases this is
209 because the sar and sadc commands do not belong to the same release of the
210 sysstat package. Remember that sar may search for sadc in predefined
211 directories (/usr/local/lib/sa, /usr/lib/sa, ...) before looking in the
212 current directory! With sysstat version 11.1.5 and later, enter "sar --sadc"
213 to determine which data collector is called by sar.
214
215 ~~~
216
217 2.4. I get the following error message when I try to run sar:
218 Cannot open /var/log/sa/sa30: No such file or directory
219
220 Please read the sar(1) manual page! Daily data files are created by default
221 in the /var/log/sa directory using the data collector (sadc) or using
222 option -o with sar. Once they are created, sar can display statistics
223 saved in those files.
224 But sar can also display statistics collected "on the fly": Just enter
225 the proper options on the command line to indicate which statistics are
226 to be displayed, and also specify <interval> and <count> numbers.
227 E.g.:
228
229 # sar 2 5  --> will report CPU utilization every two seconds, five times.
230 # sar -n DEV 3  --> will report network device utilization every
231 3 seconds, in an infinite loop.
232
233 ~~~
234
235 2.5. Are sar daily data files fully compatible with Sun Solaris format
236 sar files?
237
238 No, the format of the binary data files created by sysstat's sar command
239 is not compatible with formats from other Unixes, because it contains
240 data which are closely linked to Linux.
241 For the same reason, sysstat cannot work on platforms other than Linux...
242
243 ~~~
244
245 2.6. I have some trouble running sar on my SMP box. My server crashes
246 with a kernel oops:
247 Feb 17 04:05:00 bolums1 kernel: Unable to handle kernel paging request
248 at virtual address fffffc1c
249 Feb 17 04:05:00 bolums1 kernel: current->tss.cr3 = 19293000, %cr3 = 19293000
250 Feb 17 04:05:00 bolums1 kernel: *pde = 0026b067
251 Feb 17 04:05:00 bolums1 kernel: *pte = 00000000
252 Feb 17 04:05:00 bolums1 kernel: Oops: 0000
253 Feb 17 04:05:00 bolums1 kernel: CPU:    0
254 Feb 17 04:05:00 bolums1 kernel: EIP:
255 <...>
256
257 The trouble you have is triggered by a *Linux* kernel bug, not a sysstat
258 one... The best solution is to upgrade your kernel to the latest stable
259 release.
260 Also, if you cannot upgrade your box, try to configure sysstat with the
261 SMP race workaround:
262
263 $ ./configure --enable-smp-race
264
265 or answer 'y' to the question:
266 "Linux SMP race in serial driver workaround? (y/n) [--enable-smp-race]"
267 if you use the Interactive Configuration script (iconfig).
268 Indeed, we found that 2.2.x kernels (with x <= 15) have an SMP race
269 condition, which the sar command may trigger when it reads the
270 /proc/tty/driver/serial file.
271 Note: Option "--enable-smp-race" was removed in sysstat version 9.1.4.
272 Anyway you don't run a kernel 2.2.x any more, do you?
273
274 ~~~
275
276 2.7. The "Average:" results from the sar command are just rubbish...
277 E.g.:
278  11:00:00 AM       CPU     %user     %nice   %system     %idle
279  11:10:00 AM       all      0.54      0.00      0.89     98.57
280  11:20:01 AM       all      3.02      8.05     22.85     66.08
281  11:30:01 AM       all      8.15      0.00      2.31     89.54
282  11:40:01 AM       all      8.03      0.00      2.42     89.55
283  11:50:01 AM       all     16.04      0.00      2.81     81.16
284  12:00:00 PM       all     21.11      0.00      3.23     75.66
285  03:40:01 PM       all    100.01    100.01    100.01      0.00
286  04:40:00 PM       all    100.00      0.00    100.00      0.00
287  04:50:00 PM       all      5.87      0.00      1.26     92.87
288  05:00:00 PM       all      4.70      0.00      1.48     93.82
289  05:10:00 PM       all      4.93      0.00      1.29     93.78
290  Average:          all    100.22    100.20    100.13      0.00
291
292 Your sar command was not installed properly. Whenever your computer
293 is restarted (as it is the case here between 12:00:00 PM and 03:40:01 PM),
294 the 'sysstat' shell script must be called by the system, so that the
295 LINUX RESTART message can be inserted into the daily data file, indicating
296 that the relevant kernel counters have been reinitialized...
297 You can install the 'sysstat' script by hand in the relevant startup
298 directory, or you can ask sysstat to do it for you during configuration
299 stage by entering:
300
301 $ ./configure --enable-install-cron
302
303 Or you can answer 'y' to the question:
304 "Set crontab to start sar automatically? (y/n) [--enable-install-cron]"
305 if you use the Interactive Configuration script (iconfig).
306 Then compile sysstat as usual and run 'make install' as the last stage.
307
308 ~~~
309
310 2.8. My database (e.g. MySQL) doesn't appear to understand the time zone
311 displayed by 'sadf -d'...
312
313 The format includes the timezone detail in the output. This is to make
314 sure it is communicated clearly that UTC is how the data is always
315 converted and printed. Moreover we don't depend on the TZ environment
316 variable and we don't have some data converted to a different timezone
317 for any reason, known or unknown.
318 When you deal with raw accounting data you always want it in UTC.
319 Of course, you want it to all be the same when loading into a database.
320 If your database can't deal with timezones, you should write a short script
321 to strip the "UTC" characters from the data being loaded into the database.
322
323 ~~~
324
325 2.9. I tried to use options -s and -e with sadf. Unfortunately, I have
326 nothing displayed at all.
327
328 This is because no data belong to the specified time interval!
329 The time specified with options -s and -e is now always considered as
330 being given in local time to be consistent with sar default output.
331 Remember that timestamps are displayed by sadf in UTC (Coordinated
332 Universal Time) by default. Use option -T to tell sadf to display them
333 in local time.
334
335 ~~~
336
337 2.10. I cannot see all my disks when I use the sar -d command...
338
339 See question 3.1 below.
340
341 ~~~
342
343 2.11. Do you know a tool which can graphically plot the data collected by sar?
344
345 You can now draw graphs with sysstat's standard tools!
346 SVG (Scalable Vector Graphics) is a new output format that has been added to
347 sadf in sysstat version 11.3.1. Read sadf(1) manual page to learn some more
348 about this new format.
349 There are other tools lying around on the internet that you can use with older
350 sysstat versions. I haven't tested all of them and there must still be some
351 way for improvement...  First, some of them are included in the sysstat
352 package: isag (a Perl script) or sargraph (a shell script).
353 You can also find: kSar, sarvant, sar2gp, loadgraph, SysStat Charts, sarplot...
354 rrd.cgi (http://haroon.sis.utoronto.ca/rrd/scripts/) is a perl front-end for
355 rrdtool and can be used to make some graphs (see a demo at
356 http://haroon.sis.utoronto.ca/perl/rrd.cgi/sar_stats/).
357 sysstat_mail_report (https://github.com/desbma/sysstat_mail_report) is a script
358 that automatically generates and sends an email report every day/week/month
359 with graphs generated from sysstat data.
360 I've also heard of commercial tools which use sysstat: PerfMan comes to mind,
361 among others.
362 If you find others which you think are of real interest, please let me know
363 so that I can update this list.
364
365 ~~~
366
367 2.12. When I launch sadc, I get the error message:
368 flock: Resource temporarily unavailable
369
370 You are launching sadc using -L option. With this option, sadc tries to
371 get an exclusive lock on the output file. The above error message indicates
372 that another sadc process was running and had already locked the same output
373 file. Stop all sadc instances and try again.
374
375 ~~~
376
377 2.13. I have sysstat setup to run via cron:
378 0 * * * * /usr/local/lib/sa/sa1 600 6 &
379 so that I get an activity report every 10 minutes.
380 When I use sar to get my output, there is no reading for 00:00:00. This
381 means that at midnight every night there is a spike, or dip, in the graphs.
382 How should I run sysstat / sar so that I get a reading for 00:00:00?
383
384 Sysstat does get its data at midnight, but two data samples are needed to
385 display the values.
386 When there is a "file rotation" (beginning of a new day), sadc writes its data
387 at the end of the previous daily data file (/var/log/sa/sa<DD>) *and* at the
388 beginning of the new one (/var/log/sa/sa<DD+1>). Please note that '-' must be
389 used to specify the output file for sadc to be able to detect such a file
390 rotation. So a crontab like the following one should enable you to get the
391 data for midnight at the end of each daily data file:
392
393 # Activity reports every 10 minutes from 01:00:00 to 22:50:00
394 0 1-22 * * * /usr/local/lib/sa/sa1 600 6 &
395 # Activity reports every 10 minutes from 23:00:00 to 00:00:00
396 # Reporting until 00:00:00 ensures that a file rotation will be detected
397 # by sadc
398 0 23 * * * /usr/local/lib/sa/sa1 600 7 &
399 # Activity reports every 10 minutes from 00:10:00 to 00:50:00
400 10 0 * * * /usr/local/lib/sa/sa1 600 5 &
401
402 Another possible crontab would be:
403
404 */10 1-22 * * * /usr/lib/sa/sa1 1 1
405 0,10,20,30,40 23 * * * /usr/lib/sa/sa1 1 1
406 50 23 * * * /usr/lib/sa/sa1 600 2
407 10,20,30,40,50 0 * * * /usr/lib/sa/sa1 1 1
408
409 ~~~
410
411 2.14. The sar command complains with the following message:
412 Requested activities not available in file ...
413
414 This error message means that you are trying to extract non-existent activities
415 from the data file. Usually sadc reads all the available activities from the
416 system and stores them in the data file. However, to prevent data files from
417 taking too much space on disk, some activities must be explicitly set on the
418 command line to be read by sadc.
419 To tell sadc that an optional activity should be collected, use switch -S
420 followed by the keyword corresponding to that activity (see sadc(8) manual page).
421 As of this writing, optional activities are: interrupts, disks, SNMP, IPv6 and
422 power management statistics.
423 IMPORTANT NOTE: The list of activities that are saved in a file can no longer
424 be modified once the file has been created. So it is important to use the proper
425 options the first time sadc is called (whether via a crontab, a script like
426 sa1 or even the script used to insert a RESTART message when the machine is
427 rebooted).
428 NB: If the sar command complains with the error message:
429 "Requested activities not available" (without mentioning "in file"),
430 then see question 2.18 below.
431
432 ~~~
433
434 2.15. Does sar need a lot of resources to run?
435
436 No, sar doesn't need a lot of CPU to run, nor does it make your system slow,
437 contrary to what some people think. In the first place, it only runs every ten
438 minutes by default. Secondly, when it does run, it is over and done very
439 quickly. Try:
440
441 $ time /usr/lib/sa/sa1
442
443 to verify that for yourself.
444 Nor do you have to be concerned about using up all your disk space.
445 sar will use a few hundred kilobytes for a whole day's worth of data, and it
446 normally only stores one week worth (this can be configured via the HISTORY
447 variable in the /etc/sysconfig/sysstat file). It is entirely self limiting.
448 Moreover, you can ask sar to compress its datafiles older than a certain
449 number of days: see the COMPRESSAFTER parameter in the /etc/sysconfig/sysstat
450 configuration file.
451
452 ~~~
453
454 2.16. Are the measurements gathered by sadc cumulative or instantaneous values?
455
456 Each counter maintained by the kernel is cumulative since system boot. As a
457 consequence the measurements gathered by sadc are cumulative values.
458 Moreover all per-second statistics displayed by sar are average values on the
459 given time interval. So the value for counter foo at time T is calculated as:
460 foo/s = [foo(T) - foo(T-dt)] / dt
461 where dt is the interval given on the command line.
462
463 ~~~
464
465 2.17. Some fields are always displayed as 0.00 when I use the sar -d
466 command.
467
468 See question 3.2 below.
469
470 ~~~
471
472 2.18. The sar command complains with the following message:
473 Requested activities not available
474
475 This error message means that you are trying to display activities that the
476 kernel itself is unable to provide.
477 When this error message is displayed while trying to save the data into an
478 existing file ("sar -o datafile ..."), this may also be because the target
479 file cannot accept the requested activities. In this case, just try to use
480 another file or create a new one. See also question 2.14 above.
481
482 ~~~
483
484 2.19. How can I keep sar data for more than one month?
485
486 By default sar saves its data in the standard system activity data file,
487 the /var/log/sa/saDD file, where DD is the current day in the month.
488 To prevent sar from overwriting any existing files, just set the variable
489 HISTORY in /etc/sysconfig/sysstat to the number of days during which data
490 must be kept. When this variable has a value greater than 28, sa1 script
491 uses a month-by-month directory structure; datafiles are named YYYYMM/saDD
492 and the script maintains links to these datafiles to mimic the standard
493 sar datafile structure. However please note that pre-existing datafiles
494 will be deleted as links will be created and replace them.
495 Beginning with sysstat version 11.0.0, this tree of directories is no
496 longer created. When HISTORY has a value greater than 28, sa1 now calls
497 sadc with option -D set, telling it to use saYYYYMMDD instead of saDD
498 as the name for the standard system activity daily data files, where
499 YYYY stands for the current year, MM for the current month and DD for
500 the current day. All these files are saved in the same directory
501 (/var/log/sa by default).
502
503 ~~~
504
505 2.20. How can I load sar data into an Oracle database for performance
506 analysis and capacity planning?
507
508 The simplest way for that is to use sadf (a command included in sysstat
509 package) with its option -d. It displays sar data in a format that can
510 easily be ingested by a relational database system (fields are separated
511 by a semicolon). It should then be easy for a tool like SQL*Loader to
512 load the data into the Oracle database.
513
514 ~~~
515
516 2.21. The sar command displays some weird CPU values...
517 E.g.:
518 10:50:01 AM       CPU     %user     %nice   %system   %iowait     %idle
519 11:00:01 AM       all     90.90      0.00      5.17      3.93      0.00
520 11:00:01 AM         0     39.40      0.00      2.37      2.07     56.17
521 11:00:01 AM         1     29.71      0.00      1.73      1.17     67.39
522 11:00:01 AM         2     42.69      0.00      2.34      1.11     53.85
523 11:00:01 AM         3     26.24      0.00      1.41      1.61     70.74
524 ...
525
526 Sysstat may have met an overflow condition while reading CPU usage from
527 your /proc/stat file. This condition is all the more likely to happen as
528 your machine uptime is high and/or there are many processors.
529 Sysstat up to version 5.0.6 uses 32-bit integer variables to store CPU usage.
530 Then, beginning with version 5.1.1, sysstat has shifted to 64-bit variables,
531 which has fixed the problem. So try to upgrade your version of sysstat to
532 the latest stable release and check that the problem has gone.
533
534 ~~
535
536 2.22. What happened to sar's options -h, -H, -x and -X?
537
538 These old options have been removed from sar because new commands have been
539 made available. You should now use the sadf command instead of sar -h or
540 sar -H, and the pidstat command instead of sar -x or sar -X. Please read
541 their manual page to learn some more about their respective options.
542
543 ~~
544
545 2.23. What is the exact meaning of the <count> parameter for sar and sadc?
546
547 For sadc, <count> is the number of data samples collected.
548 For sar, <count> is the number of records to display (a record contains
549 the average values for counters over the given time interval - See 2.16).
550
551 Starting with an empty file <file>:
552
553 sadc <file> 1 6         will write 6 data samples to file.
554 sar -f <file> 1 6       6 is invalid because there are only 5 intervals.
555
556 Based on the <count> value entered for sadc the "valid" <count> values for
557 sar are 1 through 5. Any value greater than 5 for sar will give the
558 same output as 5 in this example. So entering sar -f <file> 1 2000
559 for a file populated with the output of sadc 1 6 <file> will give the
560 same output as sar -f <file> 1 5. Note that it all depends on the number
561 of data samples pre-existing in the data file. If the file is empty
562 when first running sadc then the above is true.
563
564 ~~
565
566 2.24. Why doesn't sar deal with sub-second sampling/monitoring?
567
568 There are two reasons for sar to not handle sub-second intervals:
569
570 1) This is not sar's purpose. sar has been created to give the
571 sys admin a global overview of its machine daily utilization so
572 that when a problem happens, he has a benchmark and can compare
573 the statistics gathered by sar with those saved before. For that
574 reason an interval of 10 minutes (which is the default for sar) is
575 quite appropriate.
576
577 2) Because this is just a dumb idea to try to gather a huge amount
578 of data on a sub-second interval basis (and sar really collects
579 a lot of data). This can be resource-consuming and you are all the
580 more prone to have an influence on the data you are retrieving as
581 the interval of time is small.
582
583 ~~
584
585 2.25. Is it possible to save only some specific activities in my
586 daily data files? It would help to make saXX files take less space
587 on disk...
588
589 sadc's option -S followed by a keyword (DISK, SNMP...)  can already
590 be used to specify which optional activities are to be collected.
591 Without this option, sadc collects a default set of activities (CPU
592 activity, memory activity, etc.)
593 Yet it is actually possible to specify explicitly which activities
594 should be collected by sadc! You have to use sadc's option -S
595 followed by a numerical value corresponding to the activity you want
596 to collect (the values are those displayed by sadf -H and preceding
597 the activity name in the list of activities). The only limitation
598 is CPU activity which is always collected for internal purpose.
599 Example: To tell sadc to not collect any activities but CPU, enter:
600
601 $ sadc -S 0
602
603 followed by the other classic options (interval, count, filename...)
604 To tell sadc to collect only CPU and network activities, replace
605 "-S 0" with "-S 0 -S 12" (the value 12 corresponds to network activity).
606 This way you can tell sadc to collect only the desired activities.
607
608
609 3. QUESTIONS RELATING TO IOSTAT
610 ###############################
611
612 3.1. I can't see all my disks when I use the iostat command...
613
614 Yes. This is a kernel limit. Old kernels (2.2.x for instance) used to
615 maintain stats for the first four devices.
616 The accounting code has changed in 2.4 kernels, and the result may (or
617 may not) be better for your system. Indeed, Linux 2.4 maintains the stats
618 in a two dimensional array, with a maximum of 16 devices (DK_MAX_DISK
619 in the kernel sources). Moreover, if the device major number exceeds
620 DK_MAX_MAJOR (whose value also defaults to 16 in the kernel sources),
621 then stats for this device will not be collected.
622 So, a solution may be simply to change the values of these limits in 
623 linux/include/linux/kernel_stat.h and recompile your kernel.
624 You should no longer have any problem with post 2.5 kernels, since
625 statistics are maintained by the kernel for all the devices.
626 In the particular case of iostat, also be sure to use the ALL keyword
627 on the command line to display statistical information relating to
628 every device, including those that are defined but have never been used
629 by the system.
630
631 ~~~
632
633 3.2. iostat -x doesn't report disk I/O statistics...
634
635 For 'iostat -x' to be able to report extended disk I/O statistics,
636 it is better to use a recent version of the Linux kernel (2.6.x).
637 Indeed, iostat tries to read data from the /proc/diskstats file or
638 from the sysfs filesystem for that.
639 But iostat may also be able to display extended statistics with
640 older kernels (e.g. 2.4.x) providing that all the necessary
641 statistical information is available in the /proc/partitions file,
642 which requires that a patch be applied to the kernel (this is
643 often done on kernels included in various distros). In recent 2.4.x
644 kernels, the /proc/partitions file has all the necessary data
645 providing that the kernel has been compiled with CONFIG_BLK_STATS=y.
646
647 ~~~
648
649 3.3. Why can't iostat display extended statistics for partitions with
650      some 2.6.x kernels?
651
652 Because the kernel maintains these stats only for devices, and not for
653 partitions! Here is an excerpt from the document iostats.txt written by
654 Rick Lindsley (ricklind@us.ibm.com) and included in the kernel source
655 documentation:
656 "There were significant changes between 2.4 and 2.6 in the I/O subsystem.
657 As a result, some statistic information disappeared. The translation from
658 a disk address relative to a partition to the disk address relative to
659 the host disk happens much earlier.  All merges and timings now happen
660 at the disk level rather than at both the disk and partition level as
661 in 2.4.  Consequently, you'll see a different statistics output on 2.6 for
662 partitions from that for disks."
663 Extended I/O statistics for partitions are available again with kernels
664 2.6.25 and later.
665
666 ~~~
667
668 3.4. I don't understand the output of iostat. It doesn't match what I expect it
669 to be...
670
671 By default iostat displays I/O activity in blocks per second. With old
672 kernels (i.e. older than 2.4.x) a block is of indeterminate size and therefore
673 the displayed values are not useful.
674 With recent kernels (kernels 2.4 and later), iostat is now able to get disk
675 activities from the kernel expressed in a number of sectors. If you take a
676 look at the kernel code, the sector size is actually allowed to vary although
677 I have never seen anything other than 512 bytes.
678
679 ~~~
680
681 3.5. Why values displayed by iostat are so different in the first report
682      from those displayed in subsequent ones?
683
684 Probably because, as written in the manual page, the first report generated
685 by iostat concerns the time since system startup, whereas subsequent ones
686 cover only the time since the previous report (that is to say, the interval
687 of time entered on the command line).
688
689 ~~~
690
691 3.6. iostat -x displays huge numbers for some fields...
692
693 Because of a Linux kernel bug, iostat -x may display huge I/O response times 
694 (svctm) and a bandwidth utilization (%util) of 100% for some devices. Indeed
695 these devices have a value for the field #9 (beginning after the device name)
696 in /proc/{partitions,diskstats} which is always different from 0, and even
697 negative sometimes. Yet this field should go to zero, since it gives the
698 number of I/Os currently in progress (it is incremented as requests are
699 submitted, and decremented as they finish).
700 To (temporarily) fix the problem, you should reboot your system to reset the
701 counters in /proc/{partitions,diskstats}.
702
703
704 4. QUESTIONS RELATING TO PIDSTAT
705 ################################
706
707 4.1. pidstat -d doesn't report task I/O statistics...
708
709 For pidstat -d to be able to report I/O statistics for tasks, you need
710 a recent Linux kernel (2.6.20 or later) with the option
711 CONFIG_TASK_IO_ACCOUNTING compiled in.
712
713 ~~~
714
715 4.2. The pidstat command complains with the following message:
716       "Requested activities not available".
717
718 This message is displayed when the pidstat command is unable to display
719 the statistics you have requested. This may happen when you try to display
720 statistics for child processes (option -T CHILD) because all options of
721 pidstat don't necessarily work for child processes. Read the manual page
722 to know which statistics are available for child processes.
723
724 ~~~
725
726 4.3. pidstat doesn't display statistics for process (task) xyz...
727
728 This must be because pidstat only displays statistics for active tasks
729 by default. If you don't use option -p on the command line, then pidstat
730 will display only tasks with non-zero statistics. For example, "pidstat -u"
731 will display only tasks that have actually used some CPU resources since
732 system startup. You should enter "pidstat -u -p ALL" to make sure that all
733 the processes are listed in the report.
734
735 ~~~
736
737 4.4. I noticed that the total CPU utilization for threads running on
738      an individual CPU can exceed 100%...
739
740 The CPU number displayed by pidstat is the CPU to which the task is attached
741 when the statistics are actually displayed. This doesn't mean that the task
742 has spent its whole interval of time attached to it. Hence the CPU ressource
743 used by a thread on an interval of time as displayed by pidstat may have
744 concerned several processors.
745
746 --      
747 Sebastien Godard (sysstat <at> orange.fr) is the author and the current
748 maintainer of this package.