check_disk: sees wrong disk consumption on btrfs (#1357)

waja notifications at github.com
Wed Sep 30 15:44:22 CEST 2015


In Debian we got reported (https://bugs.debian.org/800345) the following
bugreport by Klaus Ethgen:

 Since several days, one of my checks went red for one of my boxes,
mentioned that / is 100% full. But this is not true, there is plenty of
space left.

   ~> df -Th
   Filesystem		    Type      Size  Used Avail Use% Mounted on
   /dev/sda1		    btrfs     502M  338M  169M	67% /
   ...

   ~> btrfs fi df /
   System, single: total=4.00MiB, used=4.00KiB
   Data+Metadata, single: total=497.81MiB, used=329.71MiB
   GlobalReserve, single: total=8.00MiB, used=0.00B

   ~> /usr/lib/nagios/plugins/check_disk -w '3%' -c '1%'
   DISK CRITICAL - free space: / 0 MB (0% inode=-)]; ...

   ~> grep ' / ' /proc/mounts
   /dev/sda1 / btrfs
   rw,nodiratime,relatime,compress=zlib,ssd,discard,space_cache,autodefrag 0
   0

All other partitions worked well but it constantly shows / to be full.

   ~> /usr/lib/nagios/plugins/check_disk -w '3%' -c '1%' -vvv
   Thresholds(pct) for / warn: 3,000000 crit 1,000000
   calling stat on /
   For /, used_pct=100 free_pct=0 used_units=337 free_units=0
   total_units=501 used_inodes_pct=-1 free_inodes_pct=101
   fsp.fsu_blocksize=4096 mult=1048576
   Freespace_units result=0
   Freespace% result=2
   Usedspace_units result=0
   Usedspace_percent result=0
   Usedinodes_percent result=0
   Freeinodes_percent result=0

And to give you what stat gives:
   ~> stat -f /
     File: "/"
       ID: a446833a80ceeb6a Namelen: 255     Type: btrfs
   Block size: 4096	  Fundamental block size: 4096
   Blocks: Total: 128472     Free: 42014      Available: 43031
   Inodes: Total: 0	     Free: 0

I think, I found the bug.

line 1044:
   p->available = fsp->fsu_bavail > fsp->fsu_bfree ? 0 : fsp->fsu_bavail;

But from the stat I see that:
   ... Free: 41708	Available: 42725

I think, that BDE^HD workarround here is broken for btrfs and maybe
other filesystems that supports compression.

-- 
Reply to this email on GitHub:
https://github.com/monitoring-plugins/monitoring-plugins/issues/1357
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20150930/68644167/attachment.html>


More information about the Devel mailing list