check_disk fails to check disk path

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
SteffenPoulsen
Posts: 6
Joined: Wed Jun 18, 2014 5:33 am

check_disk fails to check disk path

Post by SteffenPoulsen »

check_disk fails to check disk path

I would like to use check_disk to check the free space of /var01. This is a simple directory created under /.

How do I do this?

If I do _not_ use -E, check_disk will report the free space of /var. Which does not make sense to me, instead I would expect it to report the free space of /.

If I _do_ use -E, check disk will complain that /var01 is not found.

I am probably missing the obvious, looking forward to be enlightened :-)

---

Code: Select all

# mkdir /var01

# df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             8.9G  3.0G  5.5G  35% /

# df -h /var
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             9.5G  5.0G  4.1G  56% /var

# df -h /var01
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             8.9G  3.0G  5.5G  35% /

# ./plugins/check_disk -w 10% -c 5% -W 10% -K 5% -p /var01
DISK OK - free space: /var 4119 MB (44% inode=98%);| /var=5068MB;8719;9203;0;9688

# ./plugins/check_disk -w 10% -c 5% -W 10% -K 5% -E -p /var01
DISK CRITICAL: /var01 not found

# ./plugins/check_disk --version
check_disk v2.0.2 (nagios-plugins 2.0.2)
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_disk fails to check disk path

Post by tmcdonald »

I'm a bit confused by what you are trying to do. check_disk is not used to check a directory, but rather a disk or a partition. Unless /var01 is a mount point for another disk/partition, checking it will only reveal information about "/". The -E flag just looks for an exact match, so leaving that out goes for /var which is the closest match to /var01.
Former Nagios employee
SteffenPoulsen
Posts: 6
Joined: Wed Jun 18, 2014 5:33 am

Re: check_disk fails to check disk path

Post by SteffenPoulsen »

Ok, I understand the confusion on the "what are you trying to do" part. Let me see if I can explain this a bit more in detail.

In the real world I am trying to set up check_disk checks for some Oracle cluster file systems. An introduction can be seen at http://docs.oracle.com/cd/E19680-01/htm ... 4n6c5.html.

This involves /global, /global01, /global02 etc., and under each of these a set of mount points that I would like to monitor with check_disk.

So, sometimes a partition is mounted at i.e. /global01/oracle, sometimes it is not.

What I am trying to figure out is how to avoid that the checks that I set up against /global01/* can be prevented from reporting the status of /global (when no partition is currently mounted in /global01/*).
Unless /var01 is a mount point for another disk/partition, checking it will only reveal information about "/"
Yes, that is precisely what I would like check_disk to do. To report the information about the actual partition that the path belongs to currently. And this is what I can't get it to do. What it does in the example is that it reveals information about "/var". Which is completely unrelated. It is not a "closest match" in my book. It is a directly misleading "match" at best.

Perhaps check_disk is just not the right tool for this job. It is possible that check_disk simply does not support this scenario. I am just curious if there is any way at all to get it to do what I want it to do.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_disk fails to check disk path

Post by sreinhardt »

that's very interesting behavior. What happens if you remove -p and simply append the path /var01 to the end of your command? Otherwise I will do some digging tonight into check_disk, I have to already anyway so this works out well!
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
SteffenPoulsen
Posts: 6
Joined: Wed Jun 18, 2014 5:33 am

Re: check_disk fails to check disk path

Post by SteffenPoulsen »

In this case it doesn't appear to change the behaviour to remove the -p flag.

And happy digging :-)
# ./plugins/check_disk -w 10% -c 5% -W 10% -K 5% -p /var01 /var01
DISK OK - free space: /var 4115 MB (44% inode=98%);| /var=5072MB;8719;9203;0;9688

# ./plugins/check_disk -w 10% -c 5% -W 10% -K 5% /var01
DISK OK - free space: /var 4115 MB (44% inode=98%);| /var=5072MB;8719;9203;0;9688

# df -h /var01
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 8.9G 3.0G 5.5G 35% /
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: check_disk fails to check disk path

Post by lmiltchev »

Maybe you can try this plugin as an alternative:

http://exchange.nagios.org/directory/Pl ... ks/details
Be sure to check out our Knowledgebase for helpful articles and solutions!
SteffenPoulsen
Posts: 6
Joined: Wed Jun 18, 2014 5:33 am

Re: check_disk fails to check disk path

Post by SteffenPoulsen »

Neither SNMP or PHP are available here, so the check_usolved_disks plugin is not a viable alternative. But thank you anyway, lmiltchev :-)

Out of ideas for check_disk?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: check_disk fails to check disk path

Post by lmiltchev »

Out of ideas for check_disk?
Almost. :(
What happens when you use "-M" flag (--mountpoint) instead of "-p"?
Be sure to check out our Knowledgebase for helpful articles and solutions!
SteffenPoulsen
Posts: 6
Joined: Wed Jun 18, 2014 5:33 am

Re: check_disk fails to check disk path

Post by SteffenPoulsen »

Thank you for the suggestion, lmiltchev.

With -M it is still the same problem, check_disk again checks the wrong partition :-(

(It still reports the usage of /dev/sda2 instead of /dev/sda3 as expected).

Code: Select all

# df -h /var01
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             8.9G  2.9G  5.5G  35% /
# ./check_disk -w 10% -c 5% -W 10% -K 5%  -M /var01
DISK OK - free space: /dev/sda2 2907 MB (31% inode=98%);| /dev/sda2=6280MB;8719;9203;0;9688
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_disk fails to check disk path

Post by sreinhardt »

Updates: not yet, it is on my short list for the 2.1 release, but it might be a week or more before I have a proper fix for it. I will definitely post back when we do.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked