⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 faq

📁 linux下查看系统工具原码,如IOSTAT等
💻
📖 第 1 页 / 共 2 页
字号:
that the relevant kernel counters have been reinitialized...You can install the 'sysstat' script by hand in the relevant startupdirectory, or you can ask sysstat to do it for you: answer 'y' to thequestion "Set crontab to start sar automatically" during config stage('make config'), then compile sysstat as usual and run 'make install'as the last stage.~~~2.8. My database (e.g. MySQL) doesn't appear to understand the time zonedisplayed by 'sadf -d'...The format includes the timezone detail in the output. This is to makesure it is communicated clearly that UTC is how the data is alwaysconverted and printed. Moreover we don't depend on the TZ environmentvariable and we don't have some data converted to a different timezonefor any reason, known or unknown.When you deal with raw accounting data you always want it in UTC.Of course, you want it to all be the same when loading into a database.If your database can't deal with timezones, you should write a short scriptto strip the "UTC" characters from the data being loaded into the database.~~~2.9. I tried to use the -p option of the sadf command, together with theoptions -s and -e. Unfortunately, I have nothing displayed at all.This is because no data belong to the specified time interval!In fact, -p option makes sadf display its timestamp as a UTC value(Coordinated Universal Time), as indicated in the manual page. The UTC valuemay be different from the value that sar (or sadf without option -p) displays.The same remark applies to the use of -d option.~~~2.10. I cannot see all my disks when I use the sar -d command...See question 3.1 below.~~~2.11. Do you know a tool which can graphically plot the data collected by sar?Several such tools are lying around on the internet. I haven't tested all ofthem and there must still be some way for improvement...You can find among others: isag (a Perl script included in the sysstatpackage), sarvant, sar2gp, loadgraph, SysStat Charts...I've also heard of commercial tools which use sysstat: PerfMan comes to mind,among others.If you find others which you think are of real interest, please let me knowso that I can update this list.~~~2.12. When I launch sadc, I get the error message:flock: Resource temporarily unavailableYou are launching sadc using -L option. With this option, sadc tries toget an exclusive lock on the output file. The above error message indicatesthat another sadc process was running and had already locked the same outputfile. Stop all sadc instances and try again.~~~2.13. I have sysstat setup to run via cron:0 * * * * /usr/local/lib/sa/sa1 600 6 &so that I get an activity report every 10 minutes.When I use sar to get my output, there is no reading for 00:00:00. Thismeans that at midnight everynight there is a spike, or dip, in the graphs.How should I run sysstat / sar so that I get a reading for 00:00:00?Sysstat does get its data at midnight, but two data samples are needed todisplay the values.When there is a "file rotation" (beginning of a new day), sadc writes its dataat the end of the previous daily data file (/var/log/sa/sa<DD>) *and* at thebeginning of the new one (/var/log/sa/sa<DD+1>). Please note that '-' must beused to specify the output file for sadc to be able to detect such a filerotation. So a crontab like the following one should enable you to get thedata for midnight at the end of each daily data file :# Activity reports every 10 minutes from 01:00:00 to 22:50:000 1-22 * * * /usr/local/lib/sa/sa1 600 6 &# Activity reports every 10 minutes from 23:00:00 to 00:00:00# Reporting until 00:00:00 ensures that a file rotation will be detected# by sadc0 23 * * * /usr/local/lib/sa/sa1 600 7 &# Activity reports every 10 minutes from 00:10:00 to 00:50:0010 0 * * * /usr/local/lib/sa/sa1 600 5 &~~~2.14. The sar command complains with the following message:Requested activities not available in file.This error message means that you are trying to extract non-existent activitiesfrom the data file. Usually sadc reads all the available activities from thesystem and stores them in the data file. However, to prevent data files fromtaking too much space on disk, some activities must be explicitly set on thecommand line to be read by sadc. One example is -I option which must be usedtogether with sadc to be able to extract statistics for individual interruptsfrom the data file. Another example is -d option for disks statistics.Other activities cannot be saved into a file at all even if you specify therelevant options on the command line. Process statistics (-x and -X options)are such activities.Please read sadc manual page to know exactly which activities may be extractedfrom a data file.NB: If the sar command complains with the error message:"Requested activities not available" (without mentioning "in file"),it means that you are trying to display activities that the kernel itself isunable to provide.~~~2.15. Does sar need a lot of resources to run?No, sar doesn't need a lot of CPU to run, nor does it make your system slow,contrary to what some people think. In the first place, it only runs every tenminutes by default. Secondly, when it does run, it is over and done veryquickly. Try:time /usr/lib/sa/sa1to verify that for yourself.Nor do you have to be concerned about using up all your disk space.sar will use about 220 kB for a whole day's worth of data, and it normally onlystores one week worth, and won't keep more than a month. It is entirely selflimiting. ~~~2.16. Are the measurements gathered by sadc cumulative or instantaneous values?Each counter maintained by the kernel is cumulative since system boot. As aconsequence the measurements gathered by sadc are cumulative values.Moreover all per-second statistics displayed by sar are average values on thegiven time interval. So the value for counter foo at time T is calculated as:foo/s = [foo(T) - foo(T-dt)] / dtwhere dt is the interval given on the command line.~~~2.17. Some fields are always displayed as 0.00 when I use the sar -dcommand.See question 3.2 below.3. QUESTIONS RELATING TO IOSTAT###############################3.1. I can't see all my disks when I use the iostat command...Yes. This is a kernel limit. Old kernels (2.2.x for instance) used tomaintain stats for the first four devices.The accounting code has changed in 2.4 kernels, and the result may (ormay not) be better for your system. Indeed, Linux 2.4 maintains the statsin a two dimensional array, with a maximum of 16 devices (DK_MAX_DISKin the kernel sources). Moreover, if the device major number exceedsDK_MAX_MAJOR (whose value also defaults to 16 in the kernel sources),then stats for this device will not be collected.So, a solution may be simply to change the values of these limits in linux/include/linux/kernel_stat.h and recompile your kernel.You should no longer have any problem with post 2.5 kernels, sincestatistics are maintained by the kernel for all the devices.In the particular case of iostat, also be sure to use the ALL keywordon the command line to display statistical information relating toevery device, including those that are defined but have never been usedby the system.~~~3.2. iostat -x doesn't report disk I/O statistics...For 'iostat -x' to be able to report extended disk I/O statistics,it is better to use a recent version of the Linux kernel (2.6.x).Indeed, iostat tries to read data from the /proc/diskstats file orfrom the sysfs filesystem for that.But iostat may also be able to display extended statistics witholder kernels (e.g. 2.4.x) providing that all the necessarystatistical information is available in the /proc/partitions file,which requires that a patch be applied to the kernel (this isoften done on kernels included in various distros). In recent 2.4.xkernels, the /proc/partitions file has all the necessary dataproviding that the kernel has been compiled with CONFIG_BLK_STATS=y.~~~3.3. Why can't iostat display extended statistics for partitions with     2.6.x kernels?Because the kernel maintains these stats only for devices, and not forpartitions! Here is an excerpt from the document iostats.txt written byRick Lindsley (ricklind@us.ibm.com) and included in the kernel sourcedocumentation:"There were significant changes between 2.4 and 2.6 in the I/O subsystem.As a result, some statistic information disappeared. The translation froma disk address relative to a partition to the disk address relative tothe host disk happens much earlier.  All merges and timings now happenat the disk level rather than at both the disk and partition level asin 2.4.  Consequently, you'll see a different statistics output on 2.6 forpartitions from that for disks."~~~3.4. I don't understand the output of iostat. It doesn't match what I expect itto be...By default iostat displays I/O activity in blocks per second. With oldkernels (i.e. older than 2.4.x) a block is of indeterminate size and thereforethe displayed values are not useful.With recent kernels (kernels 2.4 and later), iostat is now able to get diskactivities from the kernel expressed in a number of sectors. If you take alook at the kernel code, the sector size is actually allowed to vary althoughI have never seen anything other than 512 bytes.~~~3.5. Why values displayed by iostat are so different in the first report     from those displayed in subsequent ones?Probably because, as written in the manual page, the first report generatedby iostat concerns the time since system startup, whereas subsequent onescover only the time since the previous report (that is to say, the intervalof time entered on the command line).~~~3.6. iostat -x displays huge numbers for some fields...Because of a Linux kernel bug, iostat -x may display huge I/O response times (svctm) and a bandwidth utilization (%util) of 100% for some devices. Indeedthese devices have a value for the field #9 (beginning after the device name)in /proc/{partitions,diskstats} which is always different from 0, and evennegative sometimes. Yet this field should go to zero, since it gives thenumber of I/Os currently in progress (it is incremented as requests aresubmitted, and decremented as they finish).To (temporarily) solve the problem, you should reboot your system to reset thecounters in /proc/{partitions,diskstats}.--	Sebastien Godard (sysstat <at> wanadoo.fr) is the author and the currentmaintainer of this package.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -