====== diskstats plugin ====== This plugin provides an interface to the /proc/diskstats file on kernel >= 2.6. ---- ===== Functions ===== |diskstats(device, key, delay)|parse /proc/diskstats| //device// is a disk device name, e.g. 'hda' (do a //cat /proc/diskstats// for valid names on your system) //key// is one of the following: |major|major device number| |minor|minor device number| |name|device name (same as key)| |reads|# of reads issued| |read_merges|# of reads merged*| |read_sectors|number of sectors read| |read_ticks|# of milliseconds spent reading| |writes|# of writes completed| |write_merges|# of writes merged*| |write_sectors|number of sectors written| |write_ticks|# of milliseconds spent writing| |in_flight|# of I/Os currently in progress| |io_ticks|# of milliseconds spent doing I/Os| |time_in_queue|weighted number of milliseconds spent doing I/Os| *Reads and writes which are adjacent to each other may be merged for efficiency. Thus two 4K reads may become one 8K read before it is ultimately handed to the disk, and so it will be counted (and queued) as only one I/O. This field lets you know how often this was done. If you want to know the exact meaning of all the keys, I'm afraid you have to dig into the kernel sources. Or someone with deeper kernel knowledge can edit the table.... Note that read_sectors and write_sectors (the most important keys) return a number of sectors. To get the number of bytes, you have to multiply this value by the sector size (usually 512). The //delay// value specifies a period of time (in milliseconds) for a delta computation. If you use a delta of 0 (zero), you get the absolute values (same as in /proc/diskstats). For delay values > 0 you get the delta value in 1/sec unit. Using a delta value of 500 msec seems to be a good choice. Note that the //device// field is interpreted as a //regular expression// (regex), if you use a regex you get the sum of all matching devices (e.g. ''diskstats ('hd.', 'read_sectors', 500)'' will return the sum of read sectors for hda, hdb, hdc, ...) **Kernel 2.4**: Kernel 2.4 does not provide a /proc/diskstats file. Use the //[[:plugin_proc_stat|proc_stat plugin]]// instead! ---- ===== Example ===== Widget Disk { class 'Text' expression diskstats('hd.', 'read_sectors', 500) + diskstats('hd.', 'write_sectors', 500) prefix 'IDE' width 10 precision 0 align 'R' update 300 } ----