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