Page 1 of 1

Check_disk error with bind mount

Posted: Thu Aug 27, 2015 3:06 am
by shakenfr
Hello,

I have nagios-plugins 2.0.2, and with check_disk binaries I have this problem.
Linux = redhat 6.4
[root@opdhnbd02 ~]# su - nagiosagent
-bash-4.1$ id
uid=2201(nagiosagent) gid=2201(nagiosagent) groups=2201(nagiosagent)
-bash-4.1$ df -h /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-tmp_lv
1008M 36M 922M 4% /tmp

-bash-4.1$ cd /opt/nagiosagent/current/nagios_plugins/
-bash-4.1$ ./check_disk -W 0 -K 0 -p /tmp
DISK CRITICAL - free space: /readonly/tmp 11077587207363 MB (0% inode=0%);| /readonly/tmp=17403133454107MB;;;0;13795428254188

but /tmp has only 4% used and it's not critical. I ask for /tmp and it returns /readonly/tmp; not good

I have a readonly bind mount in /etc/fstab

/tmp /readonly/tmp none ro,nosuid,nodev,bind 0 0


Is it corrected ? have you an idea of the problem?

best
bruno

Re: Check_disk error with bind mount

Posted: Thu Aug 27, 2015 12:07 pm
by jdalrymple
I don't have the answer, but happy to share my experience here:

1) Didn't even know you could just put another filesystem in column 1 of /etc/fstab - news to me:

Code: Select all

[root@localhost plugins]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Mon Feb 16 08:43:42 2015
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_localhost-lv_root /                       ext4    defaults        1 1
UUID=5d505806-b260-4ebf-ad5e-aed15121a0dd /boot                   ext4    defaults        1 2
/dev/mapper/vg_localhost-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
tmpfs                   /test                   tmpfs   defaults        0 0
/test                   /readonly/test          none    ro,nosuid,nodev,bind 0 0
[root@localhost plugins]# mount -o remount /readonly/test
[root@localhost plugins]# mount
/dev/mapper/vg_localhost-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
tmpfs on /test type tmpfs (rw)
/test on /readonly/test type none (ro,nosuid,nodev,bind)
2) Looks good right? So does this:

Code: Select all

[root@localhost plugins]# ./check_disk -c 0 -w 0 -p /readonly/test
DISK OK - free space: /readonly/test 490 MB (100% inode=99%);| /readonly/test=0MB;490;490;0;490
3) So the only advice I have to offer is upgrade:

Code: Select all

[root@localhost plugins]# ./check_disk --version
check_disk v2.0.3 (nagios-plugins 2.0.3)
**edit**

You have this:
shakenfr wrote:-bash-4.1$ ./check_disk -W 0 -K 0 -p /tmp
Note my usage, "-w" and "-c" - not sure what affect that will have.