Fix for a filesystem statistic error

Issue #877 resolved
Lutz Mader created an issue

Hello Tildeslash,
customer systems (Linux SLES 11/12 with monit 5.26.0/5.25.2) does not collect the disk statistic well in the past. The disk usage data will collected, but the disk activity data will not.

The "monit.log" file contain sometime some error messages:

[CET Mar 19 15:03:27] error    : filesystem statistic error: cannot read /sys/class/block/as12345avol/stat -- No such file or directory
[CET Mar 19 15:47:33] error    : filesystem statistic error: cannot read /sys/class/block/as12345avol/stat -- No such file or directory
[CET Mar 19 15:53:33] error    : filesystem statistic error: cannot read /sys/class/block/as12345avol/stat -- No such file or directory

"monit -I -vv" give some usefull information also:

Reloading mount information for filesystem '/opt/as12345a'
filesystem statistic error: cannot read /sys/class/block/as12345avol/stat -- No such file or directory

"df -T" give the following information:

Filesystem                        Type  1K-blocks      Used Available Use% Mounted on
/dev/vx/dsk/as12345dg/as12345avol vxfs   52328448   5795415  43628907  12% /usd/as12345a

"ls -la" shows the following:

brw------- 1 root root 199, 20001 Apr 14  2019 /dev/vx/dsk/as12345dg/as12345avol

With "cat /proc/diskstats | grep 20001" I got:

199   20001 VxVM20001 567479 0 6640784 449048 37475 1 169389 1604 0 314528 450084

And (more easy to handle and faster) with “cat /sys/dev/block/199:20001/stat" I got:

567479 0 6640784 449048 37475 1 169389 1604 0 314528 450084

Based on this information I patched the src/device/sysdep_LINUX.c file (I append a unified diff file to patch the sources) and build monit. Monit handle the "vxfs" (Veritas filesystem) correctly, now.

Feel free to use my patch, it is a suggestion only,
with regards,
Lutz

p.s.
The patch reads the activity statistic data from the sysfs and the procfs based on the device major and minor number, but I think reading sysfs works well and is more easy.
Maybe I will remove reading the procfs data in the future, my patch file (vxfs-src-monit-5.26.0.diff) contain the whole patch I used for "src/device/sysdep_LINUX.c".

Comments (10)

  1. Lutz Mader reporter

    Nice to see,
    without the fix it looked like this.

    Filesystem 'Dienst_Fs'
      status                       OK
      monitoring status            Monitored
      monitoring mode              active
      on reboot                    start
      filesystem type              vxfs
      filesystem flags             rw,delaylog,largefiles,ioerror=mwdisable
      permission                   755
      uid                          0
      gid                          0
      block size                   1 kB
      space total                  400.0 GB (of which 1.9% is reserved for root user)
      space free for non superuser 113.8 GB [28.4%]
      space free total             121.2 GB [30.3%]
      inodes total                 31972776
      inodes free                  31778463 [99.4%]
      data collected               Fri, 31 Jan 2020 09:51:00
    

    And with the fix there is the disk activity data for Veritas Filesystems (vxfs) available, also.

    Filesystem 'Dienst_Fs'
      status                       OK
      monitoring status            Monitored
      monitoring mode              active
      on reboot                    start
      filesystem type              vxfs
      filesystem flags             rw,delaylog,largefiles,ioerror=mwdisable
      permission                   755
      uid                          0
      gid                          0
      block size                   1 kB
      space total                  400.0 GB (of which 1.9% is reserved for root user)
      space free for non superuser 113.7 GB [28.4%]
      space free total             121.2 GB [30.3%]
      inodes total                 31955176
      inodes free                  31760862 [99.4%]
      read                         870.8 B/s [16.1 GB total], 0.1 reads/s [268080 reads total]
      write                        2.4 MB/s [6.3 GB total], 35.6 writes/s [105166 writes total]
      service time                 0.021ms/operation (of which read 0.000ms, write 0.021ms)
      data collected               Fri, 31 Jan 2020 09:54:07
    

    Filesystem status details for a "vxfs" filesystem with the read, write and service time activity statistic data.

    With regards,
    Lutz

  2. Lutz Mader reporter

    Hello Jan-Henrik,

    I try to make a pull request, but it seems to I am not authorized to do this or something is goint wrong. I try to do this via Browser and SourceTree (a tool from Atlassian). I signed the CLA.

    Sorry, Lutz

  3. hauk

    To make a PR, first fork the Monit repo. Use Bitbucket to make a branch of your fork and apply your changes. Then in your branches overview on Bitbucket you can create a PR.

  4. Log in to comment