aouyar/PyMunin

/dev/root confuses diskiostats plugin in RHEL 5

asciipip opened this issue · 2 comments

I have run into a problem on some RHEL 5.x-based systems. The root filesystem is mounted from the /dev/root device, which in RHEL 5 appears to be an actual device that duplicates another device with a different name. Unfortunately, this means that /proc/mounts says that /dev/root is mounted while /proc/diskstats shows the normal device name. Currently, PyMunin handles this badly; when diskiostats tries to call DiskIOInfo().getFilesystemStats('/') in _fetchDevAll(), it gets a value of nil for stats, which causes a type error the first time the code treats stats as a dict.

For some more clarity, let me show the results of some commands on a RHEL 5 system:

$ ls -l /dev/root /dev/sda3
brw------- 1 root root 8, 3 Jan 30 12:50 /dev/root
brw-r----- 1 root disk 8, 3 Jan 30 17:50 /dev/sda3
$ perl -ane 'print if $F[1] eq "/"' /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext3 rw,data=ordered 0 0
$ perl -ane 'print if $F[2] =~ /root|sda3/' /proc/diskstats 
   8    3 sda3 2471051 580991 267371810 5123067 4746835 9666044 115304144 2955345 0 3129961 8077868

RHEL 6 behaves better and works with PyMunin as it currently stands:

$ ls -l /dev/root /dev/sda1
lrwxrwxrwx 1 root root    4 Feb  1 15:43 /dev/root -> sda1
brw-rw---- 1 root disk 8, 1 Feb  1 15:43 /dev/sda1
$ perl -ane 'print if $F[1] eq "/"' /proc/mounts
rootfs / rootfs rw 0 0
/dev/sda1 / ext3 rw,relatime,errors=continue,user_xattr,acl,barrier=1,data=ordered 0 0
$ perl -ane 'print if $F[2] =~ /root|sda1/' /proc/diskstats
   8       1 sda1 28317 190 854802 30947 1112076 2735850 31198280 10751539 0 224885 10782419

I am working on a fix that I would probably be publishing tomorrow.

Thanks for informing of the issue, and sending a detailed bug report.

Closing. After the last commit the issue should be fixed. Please do not hesitate to reopen the issue if the issue keeps affecting you.