====== proc_stat plugin ====== This plugin provides an interface to the /proc/stat file. ---- ===== Functions ===== |proc_stat(key)|parse absolute values from /proc/stat| |proc_stat(key, delay)|parse delta values from /proc/stat| |proc_stat::cpu(key, delay)|parse cpu info from /proc/stat| |proc_stat::disk(device, key, delay)|parse disk info from /proc/stat| ---- ==== proc_stat(key) ==== Valid keys are: |page.in|number of page-in events| |page.out|number of page-out events| |swap.in|number of swap-in events| |swap.out|number of swap-out events| |intr.|number of interrupts #n| |intr.sum|total number of interrupts| all other entries from /proc/stat are provided verbatim, with the first column as a key. Do a 'cat /proc/stat' to see which values are supported on your system. The 'delay' value specifies a period of time (in milliseconds) for a delta computation. If you use a delta of 0 (zero) or omit the delta parameter, you get the absolute values (same as in /proc/stat). 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. ---- ==== proc_stat::cpu(key, delay) ==== Valid keys are: |user|percentage spent in user mode (0..100)| |nice|percentage spent in niced tasks (0..100)| |system|percentage spent in kernel mode (0..100)| |iowait|percentage spent in kernel mode (0..100)| |irq|percentage spent in kernel mode (0..100)| |softirq|percentage spent in kernel mode (0..100)| |idle|percentage idle (0..100)| |busy|percentage busy (100-idle)| 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/stat). 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. Keys iowait,irq and softirq can be used only with **Kernel 2.6** ---- ==== proc_stat::disk(device, key, delay) ==== The 'device' parameter specifies the device in the form 'major:minor'. Do a 'cat /proc/stat' to see which devices are available on your system. 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. 'proc_stat::disk ('3:.*', 'rblk', 500)' will return the sum of read blocks for 3:0, 3:1, 3:2, ...) Valid keys are: |io|total number of disk I/O events| |rio|number of disk read events| |rblk|number of blocks read from disk| |wio|number of disk write events| |wblk|number of blocks written to disk| 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. **Kernel 2.6**: With Kernel 2.6, the 'disk_io' lines disappeared from /proc/stat, and therefore you'll get no results with this plugin. Use the [[:plugin_diskstats|diskstats-plugin]] instead! ---- ===== Example ===== Widget BusyBar { class 'Bar' expression proc_stat::cpu('busy', 500) expression2 proc_stat::cpu('system', 500) length 10 direction 'E' update 100 } Widget Disk { class 'Text' expression (proc_stat::disk('.*', 'rblk', 500) + proc_stat::disk('.*', 'wblk', 500))/2 prefix 'I/O' width 10 precision 0 align 'R' update 100 } ----