2

I have dio vicious widget for monitoring IO within an awesome widget. It is defined like so:

diowidget = widget({ type = "textbox" })
vicious.register(diowidget, vicious.widgets.dio, '<span color="#4682b4">${sda read_mb}</span>/<span color="#bf3eff">${sda write_mb}</span>', 3)

However, my hard disk uses lvm and looks like:

; df -h
Filesystem                         Size  Used Avail Use% Mounted on
rootfs                              50G  8.0G   40G  17% /
devtmpfs                           2.0G     0  2.0G   0% /dev
tmpfs                              2.0G  1.8M  2.0G   1% /dev/shm
tmpfs                              2.0G  804K  2.0G   1% /run
/dev/mapper/vg_nightwatch-lv_root   50G  8.0G   40G  17% /
tmpfs                              2.0G     0  2.0G   0% /sys/fs/cgroup
tmpfs                              2.0G     0  2.0G   0% /media
/dev/mapper/vg_nightwatch-lv_home  409G   15G  374G   4% /home

Use "mapper" instead of "sda" gives me an Invalid markup.

What should I use instead?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175

1 Answers1

2

Use the source, which reads (excerpt)

for line in io.lines("/proc/diskstats") do
    local device, read, write =
        -- Linux kernel documentation: Documentation/iostats.txt
        string.match(line, "([^%s]+) %d+ %d+ (%d+) %d+ %d+ %d+ (%d+)")
    disk_lines[device] = { read, write }
end
[...]
-- Calculate and store I/O
helpers.uformat(disk_usage, device.." read",  read,  unit)
helpers.uformat(disk_usage, device.." write", write, unit)
helpers.uformat(disk_usage, device.." total", read + write, unit)
[...]
return disk_usage

Thus whatever is listed in your /proc/diskstats becomes the key to disk_usage and can thus be queried. I don't use LVM so I cannot guess. It seems fairly complicated, though, since the I/O of a virtual device, well,... what is it you'd like to measure? However, if you use one device only, the numbers would obviously make sense and this hopefully helps you further.

sr_
  • 15,224
  • 49
  • 55
  • Clearly, if I wanted detailed information, I would use `iostat`. All I want is an indication that the hard drive is doing work, so I guess that `sda` (or whatever) would work well. Thank you. – Sardathrion - against SE abuse Aug 02 '12 at 09:31