** Description changed:

+ [Impact]
+ 
+ False positive reports are generated in monitoring tools when artificial
+ file systems are mounted, as they show 100% disk utilisation, and
+ therefore add an unnecessary (but fatal sounding) "CRITICAL DISK" noise.
+ But, if we exclude them by default as we did in the first place in bug
+ 1827159, we limit the use of command options that are commonly used in
+ scripts and that, because of this exclusion, cannot operate on this kind
+ of filesystems (e.g. the path option or the include filesystem option
+ -as excluding has preference over including).
+ 
+ [Test Plan]
+ 
+ 0.Preparing the test environment:
+ 
+ #Preparing the container
+ lxc launch images:ubuntu/focal checkdisks-focal
+ lxc shell checkdisks-focal
+ apt update -y
+ apt upgrade -y
+ 
+ #Installing necessary tools
+ apt install monitoring-plugins
+ apt install snapd
+ 
+ #Mount some synthetic systems and make use of snap space
+ mkdir /reproduce-tmpfs
+ mkdir /reproduce-squashfs
+ mkdir /reproduce-tracefs
+ mount -t tmpfs -o rw,size=2G tmpfs /reproduce-tmpfs
+ mount -t tmpfs -o rw,size=2G squashfs /reproduce-squashfs
+ mount -t tmpfs -o rw,size=2G tracefs /reproduce-tracefs
+ snap install gnome-calculator
+ 
+ 1. Bad cases:
+ 
+ # "CRITICAL DISK" noise
+ 
+ $ /usr/lib/nagios/plugins/check_disk -w 10 -c 10
+ DISK CRITICAL - free space: /dev 448 MB (100% inode=99%); /run 96 MB (98% 
inode=99%); / 884 MB (18% inode=80%); /dev/shm 485 MB (100% inode=99%); 
/run/lock 5 MB (100% inode=99%); /snap/lxd/21835 0 MB (0% inode=0%); 
/snap/core20/1270 0 MB (0% inode=0%); /snap/snapd/14295 0 MB (0% inode=0%); 
/boot/efi 99 MB (95% inode=-); /run/snapd/ns 96 MB (98% inode=99%); 
/snap/snapd/14549 0 MB (0% inode=0%); /run/user/1000 97 MB (99% inode=99%); 
/snap/bare/5 0 MB (0% inode=0%); /snap/multipass-sshfs/145 0 MB (0% inode=0%); 
/home/ubuntu/monitoring-plugins 1024000 MB (100% inode=100%); 
/home/ubuntu/reproduce 2048 MB (100% inode=99%); /home/ubuntu/reproduce-squash 
2048 MB (100% inode=99%); /snap/core20/1328 0 MB (0% inode=0%); 
/home/ubuntu/reproduce-tracefs 2048 MB (100% inode=99%);| 
/dev=0MB;438;438;0;448 /run=0MB;87;87;0;97 /=3886MB;4777;4777;0;4787 
/dev/shm=0MB;475;475;0;485 /run/lock=0MB;-5;-5;0;5 
/snap/lxd/21835=67MB;57;57;0;67 /snap/core20/1270=62MB;52;52;0;62 
/snap/snapd/14295=43MB;33;33;0;43 /boot/efi=5MB;94;94;0;104 
/run/snapd/ns=0MB;87;87;0;97 /snap/snapd/14549=43MB;33;33;0;43 
/run/user/1000=0MB;87;87;0;97 /snap/bare/5=0MB;-10;-10;0;0 
/snap/multipass-sshfs/145=1MB;-9;-9;0;1 
/home/ubuntu/monitoring-plugins=0MB;1023990;1023990;0;1024000 
/home/ubuntu/reproduce=0MB;2038;2038;0;2048 
/home/ubuntu/reproduce-squash=0MB;2038;2038;0;2048 
/snap/core20/1328=62MB;52;52;0;62 
/home/ubuntu/reproduce-tracefs=0MB;2038;2038;0;2048
+ 
+ $ /usr/lib/nagios/plugins/check_disk -w 10 -c 10 -e -X squashfs
+ DISK CRITICAL - free space: /run/lock 5 MB (100% inode=99%);| 
/dev=0MB;438;438;0;448 /run=0MB;87;87;0;97 /=3886MB;4777;4777;0;4787 
/dev/shm=0MB;475;475;0;485 /run/lock=0MB;-5;-5;0;5 /boot/efi=5MB;94;94;0;104 
/run/snapd/ns=0MB;87;87;0;97 /run/user/1000=0MB;87;87;0;97 
/home/ubuntu/monitoring-plugins=0MB;1023990;1023990;0;1024000 
/home/ubuntu/reproduce=0MB;2038;2038;0;2048 
/home/ubuntu/reproduce-squash=0MB;2038;2038;0;2048 
/home/ubuntu/reproduce-tracefs=0MB;2038;2038;0;2048
+ 
+ $ /usr/lib/nagios/plugins/check_disk -w 10 -c 10 -e -X tracefs
+ DISK CRITICAL - free space: /run/lock 5 MB (100% inode=99%); /snap/lxd/21835 
0 MB (0% inode=0%); /snap/core20/1270 0 MB (0% inode=0%); /snap/snapd/14295 0 
MB (0% inode=0%); /snap/snapd/14549 0 MB (0% inode=0%); /snap/bare/5 0 MB (0% 
inode=0%); /snap/multipass-sshfs/145 0 MB (0% inode=0%); /snap/core20/1328 0 MB 
(0% inode=0%);| /dev=0MB;438;438;0;448 /run=0MB;87;87;0;97 
/=3886MB;4777;4777;0;4787 /dev/shm=0MB;475;475;0;485 /run/lock=0MB;-5;-5;0;5 
/snap/lxd/21835=67MB;57;57;0;67 /snap/core20/1270=62MB;52;52;0;62 
/snap/snapd/14295=43MB;33;33;0;43 /boot/efi=5MB;94;94;0;104 
/run/snapd/ns=0MB;87;87;0;97 /snap/snapd/14549=43MB;33;33;0;43 
/run/user/1000=0MB;87;87;0;97 /snap/bare/5=0MB;-10;-10;0;0 
/snap/multipass-sshfs/145=1MB;-9;-9;0;1 
/home/ubuntu/monitoring-plugins=0MB;1023990;1023990;0;1024000 
/home/ubuntu/reproduce=0MB;2038;2038;0;2048 
/home/ubuntu/reproduce-squash=0MB;2038;2038;0;2048 
/snap/core20/1328=62MB;52;52;0;62 
/home/ubuntu/reproduce-tracefs=0MB;2038;2038;0;2048
+ 
+ $ /usr/lib/nagios/plugins/check_disk -w 10 -c 10 -e -X tracefs -X squashfs
+ DISK CRITICAL - free space: /run/lock 5 MB (100% inode=99%);| 
/dev=0MB;438;438;0;448 /run=0MB;87;87;0;97 /=3886MB;4777;4777;0;4787 
/dev/shm=0MB;475;475;0;485 /run/lock=0MB;-5;-5;0;5 /boot/efi=5MB;94;94;0;104 
/run/snapd/ns=0MB;87;87;0;97 /run/user/1000=0MB;87;87;0;97 
/home/ubuntu/monitoring-plugins=0MB;1023990;1023990;0;1024000 
/home/ubuntu/reproduce=0MB;2038;2038;0;2048 
/home/ubuntu/reproduce-squash=0MB;2038;2038;0;2048 
/home/ubuntu/reproduce-tracefs=0MB;2038;2038;0;2048
+ 
+ $ /usr/lib/nagios/plugins/check_disk -w 10 -c 10 -e -X tmpfs
+ DISK CRITICAL - free space: /snap/lxd/21835 0 MB (0% inode=0%); 
/snap/core20/1270 0 MB (0% inode=0%); /snap/snapd/14295 0 MB (0% inode=0%); 
/snap/snapd/14549 0 MB (0% inode=0%); /snap/bare/5 0 MB (0% inode=0%); 
/snap/multipass-sshfs/145 0 MB (0% inode=0%); /snap/core20/1328 0 MB (0% 
inode=0%);| /dev=0MB;438;438;0;448 /=3886MB;4777;4777;0;4787 
/snap/lxd/21835=67MB;57;57;0;67 /snap/core20/1270=62MB;52;52;0;62 
/snap/snapd/14295=43MB;33;33;0;43 /boot/efi=5MB;94;94;0;104 
/snap/snapd/14549=43MB;33;33;0;43 /snap/bare/5=0MB;-10;-10;0;0 
/snap/multipass-sshfs/145=1MB;-9;-9;0;1 
/home/ubuntu/monitoring-plugins=0MB;1023990;1023990;0;1024000 
/snap/core20/1328=62MB;52;52;0;62
+ 
+ # "DISK UNKNOWN" as synthetic filesystems are excluded
+ 
+ $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -p /reproduce-tmpfs
+ DISK UNKNOWN - free space:|
+ 
+ $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -N tmpfs
+ DISK UNKNOWN - free space:|
+ 
+ $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -X squashfs -N tmpfs
+ DISK UNKNOWN - free space:|
+ 
+ 2. Good cases:
+ 
+ # "CRITICAL DISK" noise
+  
+ $  /usr/lib/nagios/plugins/check_disk -w 10 -c 10
+ DISK OK - free space: / 6971 MB (85% inode=99%); /dev/fuse 32071 MB (100% 
inode=99%); /dev/net/tun 32071 MB (100% inode=99%); /dev/full 32071 MB (100% 
inode=99%); /dev/null 32071 MB (100% inode=99%); /dev/random 32071 MB (100% 
inode=99%); /dev/tty 32071 MB (100% inode=99%); /dev/urandom 32071 MB (100% 
inode=99%); /dev/zero 32071 MB (100% inode=99%); /snap 6971 MB (85% 
inode=99%);| /=1204MB;8165;8165;0;8175 /dev/fuse=0MB;32061;32061;0;32071 
/dev/net/tun=0MB;32061;32061;0;32071 /dev/full=0MB;32061;32061;0;32071 
/dev/null=0MB;32061;32061;0;32071 /dev/random=0MB;32061;32061;0;32071 
/dev/tty=0MB;32061;32061;0;32071 /dev/urandom=0MB;32061;32061;0;32071 
/dev/zero=0MB;32061;32061;0;32071 /snap=1204MB;8165;8165;0;8175
+ 
+ # "DISK UNKNOWN" as synthetic filesystems are excluded
+ 
+ $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -p /reproduce-tmpfs
+ DISK OK - free space: /reproduce-tmpfs 2048 MB (100% inode=99%);| 
/reproduce-tmpfs=0MB;1843;1945;0;2048
+ 
+ $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -N tmpfs
+ DISK OK - free space: /dev 0 MB (99% inode=99%); /dev/lxd 0 MB (100% 
inode=99%); /dev/.lxd-mounts 0 MB (100% inode=99%); 
/proc/sys/kernel/random/boot_id 0 MB (99% inode=99%); /dev/shm 32106 MB (100% 
inode=99%); /run 6421 MB (99% inode=99%); /run/lock 5 MB (100% inode=99%); 
/sys/fs/cgroup 32106 MB (100% inode=99%); /run/user/0 6421 MB (100% inode=99%); 
/run/snapd/ns 6421 MB (99% inode=99%); /reproduce-tmpfs 2048 MB (100% 
inode=99%); /reproduce-squashfs 2048 MB (100% inode=99%); /reproduce-tracefs 
2048 MB (100% inode=99%);| /dev=0MB;0;0;0;0 /dev/lxd=0MB;0;0;0;0 
/dev/.lxd-mounts=0MB;0;0;0;0 /proc/sys/kernel/random/boot_id=0MB;0;0;0;0 
/dev/shm=0MB;28895;30500;0;32106 /run=0MB;5778;6099;0;6421 
/run/lock=0MB;4;4;0;5 /sys/fs/cgroup=0MB;28895;30500;0;32106 
/run/user/0=0MB;5778;6099;0;6421 /run/snapd/ns=0MB;5778;6099;0;6421 
/reproduce-tmpfs=0MB;1843;1945;0;2048 /reproduce-squashfs=0MB;1843;1945;0;2048 
/reproduce-tracefs=0MB;1843;1945;0;2048
+ 
+ $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -N tmpfs -p /reproduce-tmpfs
+ DISK OK - free space: /reproduce-tmpfs 2048 MB (100% inode=99%);| 
/reproduce-tmpfs=0MB;1843;1945;0;2048
+ 
+ //This case is fine, as I am explicitly asking for an fs that is being 
explicitly excluded too.
+ $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -X tmpfs -p /reproduce-tmpfs
+ DISK UNKNOWN - free space:|
+ 
+ $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -X squashfs -p 
/reproduce-tmpfs
+ DISK OK - free space: /reproduce-tmpfs 2048 MB (100% inode=99%);| 
/reproduce-tmpfs=0MB;1843;1945;0;2048
+ 
+ $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -X squashfs -N tmpfs
+ DISK OK - free space: /dev 0 MB (99% inode=99%); /dev/lxd 0 MB (100% 
inode=99%); /dev/.lxd-mounts 0 MB (100% inode=99%); 
/proc/sys/kernel/random/boot_id 0 MB (99% inode=99%); /dev/shm 32106 MB (100% 
inode=99%); /run 6421 MB (99% inode=99%); /run/lock 5 MB (100% inode=99%); 
/sys/fs/cgroup 32106 MB (100% inode=99%); /run/user/0 6421 MB (100% inode=99%); 
/run/snapd/ns 6421 MB (99% inode=99%); /reproduce-tmpfs 2048 MB (100% 
inode=99%); /reproduce-squashfs 2048 MB (100% inode=99%); /reproduce-tracefs 
2048 MB (100% inode=99%);| /dev=0MB;0;0;0;0 /dev/lxd=0MB;0;0;0;0 
/dev/.lxd-mounts=0MB;0;0;0;0 /proc/sys/kernel/random/boot_id=0MB;0;0;0;0 
/dev/shm=0MB;28895;30500;0;32106 /run=0MB;5778;6099;0;6421 
/run/lock=0MB;4;4;0;5 /sys/fs/cgroup=0MB;28895;30500;0;32106 
/run/user/0=0MB;5778;6099;0;6421 /run/snapd/ns=0MB;5778;6099;0;6421 
/reproduce-tmpfs=0MB;1843;1945;0;2048 /reproduce-squashfs=0MB;1843;1945;0;2048 
/reproduce-tracefs=0MB;1843;1945;0;2048
+ 
+ [Where problems could occur]
+ 
+ As this alters the logic of how out-of-space checks are handled,
+ relevant issues to keep an eye out for would relate to filesystem checks
+ reporting improperly. These tools underlay a few different front-ends,
+ so regression bugs may get filed in a few different places, however they
+ will tend to display error messages involving check_disk, nagios, and
+ either tmpfs or tracefs. To minimize it, this changes has been done
+ after all the arguments logic has been done (thanks Richard Laager),
+ therefore excluding filesystems only if not required explicitly by the
+ user (thanks Christian Ehrhardt).
+ 
+ Note that there are likely other synthetic filesystems beyond tmpfs,
+ squashfs and tracefs (e.g. udev, usbfs, devtmpfs, fuse.*, ...) which
+ might also cause similar false positives; these should be handled as
+ separate bugs, although the proposed code here has the intention to be
+ easily used to it.
+ 
+ [Other Info]
+  
+ The intention is forward the patch to upstream once is accepted here, as the 
previous one 
(https://github.com/monitoring-plugins/monitoring-plugins/pull/1609 and 
https://github.com/monitoring-plugins/monitoring-plugins/issues/1608) was 
rejected.
+ 
+ 
+ [Original Report]
+ -------------------------------------------------------------------
  $ lsb_release -d
  Description:  Ubuntu 20.04.3 LTS
  
  $ apt-cache policy monitoring-plugins | head -n2
  monitoring-plugins:
    Installed: 2.2-6ubuntu1.1
  
  check_disk returns UNKNOWN for tmpfs filesystems, even when directed
  explicitly to check them. This is a regression introduced by the fix for
  LP: #1827159.
  
  Steps to reproduce:
  
  $ df -h /tmp
  Filesystem      Size  Used Avail Use% Mounted on
  tmpfs            16G   64K   16G   1% /tmp
  $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -p /tmp
  DISK UNKNOWN - free space:|
  
  Running the check as part of a group, even with just the one member, is
  a workaround:
  
  $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -g tmp -p /tmp
  DISK OK - free space: tmp 16058 MB (99% inode=99%);| 
tmp=0MB;14452;15255;0;16058

** Description changed:

+ [SRU]
+ 
  [Impact]
  
  False positive reports are generated in monitoring tools when artificial
  file systems are mounted, as they show 100% disk utilisation, and
  therefore add an unnecessary (but fatal sounding) "CRITICAL DISK" noise.
  But, if we exclude them by default as we did in the first place in bug
  1827159, we limit the use of command options that are commonly used in
  scripts and that, because of this exclusion, cannot operate on this kind
  of filesystems (e.g. the path option or the include filesystem option
  -as excluding has preference over including).
  
  [Test Plan]
  
  0.Preparing the test environment:
  
  #Preparing the container
  lxc launch images:ubuntu/focal checkdisks-focal
  lxc shell checkdisks-focal
  apt update -y
  apt upgrade -y
  
  #Installing necessary tools
  apt install monitoring-plugins
  apt install snapd
  
  #Mount some synthetic systems and make use of snap space
  mkdir /reproduce-tmpfs
  mkdir /reproduce-squashfs
  mkdir /reproduce-tracefs
  mount -t tmpfs -o rw,size=2G tmpfs /reproduce-tmpfs
  mount -t tmpfs -o rw,size=2G squashfs /reproduce-squashfs
  mount -t tmpfs -o rw,size=2G tracefs /reproduce-tracefs
  snap install gnome-calculator
  
  1. Bad cases:
  
  # "CRITICAL DISK" noise
  
  $ /usr/lib/nagios/plugins/check_disk -w 10 -c 10
  DISK CRITICAL - free space: /dev 448 MB (100% inode=99%); /run 96 MB (98% 
inode=99%); / 884 MB (18% inode=80%); /dev/shm 485 MB (100% inode=99%); 
/run/lock 5 MB (100% inode=99%); /snap/lxd/21835 0 MB (0% inode=0%); 
/snap/core20/1270 0 MB (0% inode=0%); /snap/snapd/14295 0 MB (0% inode=0%); 
/boot/efi 99 MB (95% inode=-); /run/snapd/ns 96 MB (98% inode=99%); 
/snap/snapd/14549 0 MB (0% inode=0%); /run/user/1000 97 MB (99% inode=99%); 
/snap/bare/5 0 MB (0% inode=0%); /snap/multipass-sshfs/145 0 MB (0% inode=0%); 
/home/ubuntu/monitoring-plugins 1024000 MB (100% inode=100%); 
/home/ubuntu/reproduce 2048 MB (100% inode=99%); /home/ubuntu/reproduce-squash 
2048 MB (100% inode=99%); /snap/core20/1328 0 MB (0% inode=0%); 
/home/ubuntu/reproduce-tracefs 2048 MB (100% inode=99%);| 
/dev=0MB;438;438;0;448 /run=0MB;87;87;0;97 /=3886MB;4777;4777;0;4787 
/dev/shm=0MB;475;475;0;485 /run/lock=0MB;-5;-5;0;5 
/snap/lxd/21835=67MB;57;57;0;67 /snap/core20/1270=62MB;52;52;0;62 
/snap/snapd/14295=43MB;33;33;0;43 /boot/efi=5MB;94;94;0;104 
/run/snapd/ns=0MB;87;87;0;97 /snap/snapd/14549=43MB;33;33;0;43 
/run/user/1000=0MB;87;87;0;97 /snap/bare/5=0MB;-10;-10;0;0 
/snap/multipass-sshfs/145=1MB;-9;-9;0;1 
/home/ubuntu/monitoring-plugins=0MB;1023990;1023990;0;1024000 
/home/ubuntu/reproduce=0MB;2038;2038;0;2048 
/home/ubuntu/reproduce-squash=0MB;2038;2038;0;2048 
/snap/core20/1328=62MB;52;52;0;62 
/home/ubuntu/reproduce-tracefs=0MB;2038;2038;0;2048
  
  $ /usr/lib/nagios/plugins/check_disk -w 10 -c 10 -e -X squashfs
  DISK CRITICAL - free space: /run/lock 5 MB (100% inode=99%);| 
/dev=0MB;438;438;0;448 /run=0MB;87;87;0;97 /=3886MB;4777;4777;0;4787 
/dev/shm=0MB;475;475;0;485 /run/lock=0MB;-5;-5;0;5 /boot/efi=5MB;94;94;0;104 
/run/snapd/ns=0MB;87;87;0;97 /run/user/1000=0MB;87;87;0;97 
/home/ubuntu/monitoring-plugins=0MB;1023990;1023990;0;1024000 
/home/ubuntu/reproduce=0MB;2038;2038;0;2048 
/home/ubuntu/reproduce-squash=0MB;2038;2038;0;2048 
/home/ubuntu/reproduce-tracefs=0MB;2038;2038;0;2048
  
  $ /usr/lib/nagios/plugins/check_disk -w 10 -c 10 -e -X tracefs
  DISK CRITICAL - free space: /run/lock 5 MB (100% inode=99%); /snap/lxd/21835 
0 MB (0% inode=0%); /snap/core20/1270 0 MB (0% inode=0%); /snap/snapd/14295 0 
MB (0% inode=0%); /snap/snapd/14549 0 MB (0% inode=0%); /snap/bare/5 0 MB (0% 
inode=0%); /snap/multipass-sshfs/145 0 MB (0% inode=0%); /snap/core20/1328 0 MB 
(0% inode=0%);| /dev=0MB;438;438;0;448 /run=0MB;87;87;0;97 
/=3886MB;4777;4777;0;4787 /dev/shm=0MB;475;475;0;485 /run/lock=0MB;-5;-5;0;5 
/snap/lxd/21835=67MB;57;57;0;67 /snap/core20/1270=62MB;52;52;0;62 
/snap/snapd/14295=43MB;33;33;0;43 /boot/efi=5MB;94;94;0;104 
/run/snapd/ns=0MB;87;87;0;97 /snap/snapd/14549=43MB;33;33;0;43 
/run/user/1000=0MB;87;87;0;97 /snap/bare/5=0MB;-10;-10;0;0 
/snap/multipass-sshfs/145=1MB;-9;-9;0;1 
/home/ubuntu/monitoring-plugins=0MB;1023990;1023990;0;1024000 
/home/ubuntu/reproduce=0MB;2038;2038;0;2048 
/home/ubuntu/reproduce-squash=0MB;2038;2038;0;2048 
/snap/core20/1328=62MB;52;52;0;62 
/home/ubuntu/reproduce-tracefs=0MB;2038;2038;0;2048
  
  $ /usr/lib/nagios/plugins/check_disk -w 10 -c 10 -e -X tracefs -X squashfs
  DISK CRITICAL - free space: /run/lock 5 MB (100% inode=99%);| 
/dev=0MB;438;438;0;448 /run=0MB;87;87;0;97 /=3886MB;4777;4777;0;4787 
/dev/shm=0MB;475;475;0;485 /run/lock=0MB;-5;-5;0;5 /boot/efi=5MB;94;94;0;104 
/run/snapd/ns=0MB;87;87;0;97 /run/user/1000=0MB;87;87;0;97 
/home/ubuntu/monitoring-plugins=0MB;1023990;1023990;0;1024000 
/home/ubuntu/reproduce=0MB;2038;2038;0;2048 
/home/ubuntu/reproduce-squash=0MB;2038;2038;0;2048 
/home/ubuntu/reproduce-tracefs=0MB;2038;2038;0;2048
  
  $ /usr/lib/nagios/plugins/check_disk -w 10 -c 10 -e -X tmpfs
  DISK CRITICAL - free space: /snap/lxd/21835 0 MB (0% inode=0%); 
/snap/core20/1270 0 MB (0% inode=0%); /snap/snapd/14295 0 MB (0% inode=0%); 
/snap/snapd/14549 0 MB (0% inode=0%); /snap/bare/5 0 MB (0% inode=0%); 
/snap/multipass-sshfs/145 0 MB (0% inode=0%); /snap/core20/1328 0 MB (0% 
inode=0%);| /dev=0MB;438;438;0;448 /=3886MB;4777;4777;0;4787 
/snap/lxd/21835=67MB;57;57;0;67 /snap/core20/1270=62MB;52;52;0;62 
/snap/snapd/14295=43MB;33;33;0;43 /boot/efi=5MB;94;94;0;104 
/snap/snapd/14549=43MB;33;33;0;43 /snap/bare/5=0MB;-10;-10;0;0 
/snap/multipass-sshfs/145=1MB;-9;-9;0;1 
/home/ubuntu/monitoring-plugins=0MB;1023990;1023990;0;1024000 
/snap/core20/1328=62MB;52;52;0;62
  
  # "DISK UNKNOWN" as synthetic filesystems are excluded
  
  $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -p /reproduce-tmpfs
  DISK UNKNOWN - free space:|
  
  $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -N tmpfs
  DISK UNKNOWN - free space:|
  
  $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -X squashfs -N tmpfs
  DISK UNKNOWN - free space:|
  
  2. Good cases:
  
  # "CRITICAL DISK" noise
-  
+ 
  $  /usr/lib/nagios/plugins/check_disk -w 10 -c 10
  DISK OK - free space: / 6971 MB (85% inode=99%); /dev/fuse 32071 MB (100% 
inode=99%); /dev/net/tun 32071 MB (100% inode=99%); /dev/full 32071 MB (100% 
inode=99%); /dev/null 32071 MB (100% inode=99%); /dev/random 32071 MB (100% 
inode=99%); /dev/tty 32071 MB (100% inode=99%); /dev/urandom 32071 MB (100% 
inode=99%); /dev/zero 32071 MB (100% inode=99%); /snap 6971 MB (85% 
inode=99%);| /=1204MB;8165;8165;0;8175 /dev/fuse=0MB;32061;32061;0;32071 
/dev/net/tun=0MB;32061;32061;0;32071 /dev/full=0MB;32061;32061;0;32071 
/dev/null=0MB;32061;32061;0;32071 /dev/random=0MB;32061;32061;0;32071 
/dev/tty=0MB;32061;32061;0;32071 /dev/urandom=0MB;32061;32061;0;32071 
/dev/zero=0MB;32061;32061;0;32071 /snap=1204MB;8165;8165;0;8175
  
  # "DISK UNKNOWN" as synthetic filesystems are excluded
  
  $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -p /reproduce-tmpfs
  DISK OK - free space: /reproduce-tmpfs 2048 MB (100% inode=99%);| 
/reproduce-tmpfs=0MB;1843;1945;0;2048
  
  $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -N tmpfs
  DISK OK - free space: /dev 0 MB (99% inode=99%); /dev/lxd 0 MB (100% 
inode=99%); /dev/.lxd-mounts 0 MB (100% inode=99%); 
/proc/sys/kernel/random/boot_id 0 MB (99% inode=99%); /dev/shm 32106 MB (100% 
inode=99%); /run 6421 MB (99% inode=99%); /run/lock 5 MB (100% inode=99%); 
/sys/fs/cgroup 32106 MB (100% inode=99%); /run/user/0 6421 MB (100% inode=99%); 
/run/snapd/ns 6421 MB (99% inode=99%); /reproduce-tmpfs 2048 MB (100% 
inode=99%); /reproduce-squashfs 2048 MB (100% inode=99%); /reproduce-tracefs 
2048 MB (100% inode=99%);| /dev=0MB;0;0;0;0 /dev/lxd=0MB;0;0;0;0 
/dev/.lxd-mounts=0MB;0;0;0;0 /proc/sys/kernel/random/boot_id=0MB;0;0;0;0 
/dev/shm=0MB;28895;30500;0;32106 /run=0MB;5778;6099;0;6421 
/run/lock=0MB;4;4;0;5 /sys/fs/cgroup=0MB;28895;30500;0;32106 
/run/user/0=0MB;5778;6099;0;6421 /run/snapd/ns=0MB;5778;6099;0;6421 
/reproduce-tmpfs=0MB;1843;1945;0;2048 /reproduce-squashfs=0MB;1843;1945;0;2048 
/reproduce-tracefs=0MB;1843;1945;0;2048
  
  $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -N tmpfs -p /reproduce-tmpfs
  DISK OK - free space: /reproduce-tmpfs 2048 MB (100% inode=99%);| 
/reproduce-tmpfs=0MB;1843;1945;0;2048
  
  //This case is fine, as I am explicitly asking for an fs that is being 
explicitly excluded too.
  $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -X tmpfs -p /reproduce-tmpfs
  DISK UNKNOWN - free space:|
  
  $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -X squashfs -p 
/reproduce-tmpfs
  DISK OK - free space: /reproduce-tmpfs 2048 MB (100% inode=99%);| 
/reproduce-tmpfs=0MB;1843;1945;0;2048
  
  $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -X squashfs -N tmpfs
  DISK OK - free space: /dev 0 MB (99% inode=99%); /dev/lxd 0 MB (100% 
inode=99%); /dev/.lxd-mounts 0 MB (100% inode=99%); 
/proc/sys/kernel/random/boot_id 0 MB (99% inode=99%); /dev/shm 32106 MB (100% 
inode=99%); /run 6421 MB (99% inode=99%); /run/lock 5 MB (100% inode=99%); 
/sys/fs/cgroup 32106 MB (100% inode=99%); /run/user/0 6421 MB (100% inode=99%); 
/run/snapd/ns 6421 MB (99% inode=99%); /reproduce-tmpfs 2048 MB (100% 
inode=99%); /reproduce-squashfs 2048 MB (100% inode=99%); /reproduce-tracefs 
2048 MB (100% inode=99%);| /dev=0MB;0;0;0;0 /dev/lxd=0MB;0;0;0;0 
/dev/.lxd-mounts=0MB;0;0;0;0 /proc/sys/kernel/random/boot_id=0MB;0;0;0;0 
/dev/shm=0MB;28895;30500;0;32106 /run=0MB;5778;6099;0;6421 
/run/lock=0MB;4;4;0;5 /sys/fs/cgroup=0MB;28895;30500;0;32106 
/run/user/0=0MB;5778;6099;0;6421 /run/snapd/ns=0MB;5778;6099;0;6421 
/reproduce-tmpfs=0MB;1843;1945;0;2048 /reproduce-squashfs=0MB;1843;1945;0;2048 
/reproduce-tracefs=0MB;1843;1945;0;2048
  
  [Where problems could occur]
  
  As this alters the logic of how out-of-space checks are handled,
  relevant issues to keep an eye out for would relate to filesystem checks
  reporting improperly. These tools underlay a few different front-ends,
  so regression bugs may get filed in a few different places, however they
  will tend to display error messages involving check_disk, nagios, and
  either tmpfs or tracefs. To minimize it, this changes has been done
  after all the arguments logic has been done (thanks Richard Laager),
  therefore excluding filesystems only if not required explicitly by the
  user (thanks Christian Ehrhardt).
  
  Note that there are likely other synthetic filesystems beyond tmpfs,
  squashfs and tracefs (e.g. udev, usbfs, devtmpfs, fuse.*, ...) which
  might also cause similar false positives; these should be handled as
  separate bugs, although the proposed code here has the intention to be
  easily used to it.
  
  [Other Info]
-  
- The intention is forward the patch to upstream once is accepted here, as the 
previous one 
(https://github.com/monitoring-plugins/monitoring-plugins/pull/1609 and 
https://github.com/monitoring-plugins/monitoring-plugins/issues/1608) was 
rejected.
  
+ The intention is forward the patch to upstream once is accepted here, as
+ the previous one (https://github.com/monitoring-plugins/monitoring-
+ plugins/pull/1609 and https://github.com/monitoring-plugins/monitoring-
+ plugins/issues/1608) was rejected.
  
  [Original Report]
  -------------------------------------------------------------------
  $ lsb_release -d
  Description:  Ubuntu 20.04.3 LTS
  
  $ apt-cache policy monitoring-plugins | head -n2
  monitoring-plugins:
    Installed: 2.2-6ubuntu1.1
  
  check_disk returns UNKNOWN for tmpfs filesystems, even when directed
  explicitly to check them. This is a regression introduced by the fix for
  LP: #1827159.
  
  Steps to reproduce:
  
  $ df -h /tmp
  Filesystem      Size  Used Avail Use% Mounted on
  tmpfs            16G   64K   16G   1% /tmp
  $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -p /tmp
  DISK UNKNOWN - free space:|
  
  Running the check as part of a group, even with just the one member, is
  a workaround:
  
  $ /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -g tmp -p /tmp
  DISK OK - free space: tmp 16058 MB (99% inode=99%);| 
tmp=0MB;14452;15255;0;16058

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1940916

Title:
  Incorrectly excludes tmpfs filesystems

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/monitoring-plugins/+bug/1940916/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to