Page 1 of 2

Plugin that checks filesystem

Posted: Mon Nov 18, 2013 12:43 pm
by srikanth.kallu
Hi,

I think we have a bug in the script that checks the file system.

I have added a new NFS shared file system to one of my host It is monitoring it which looks good so far.

I was testing it my unmounting that File system. But it still shows that servce for that file system is up and running.

So got confused about this and just created a directory and added it to my monitoring list. I stil can monitor it i was thiniking we monitor only filesystems not thed directories. ?

Re: Plugin that checks filesystem

Posted: Mon Nov 18, 2013 12:45 pm
by slansing
We need to know what plugin you are using.

Re: Plugin that checks filesystem

Posted: Tue Nov 19, 2013 11:22 am
by srikanth.kallu
It is the default one. I have attached a screenshot of my settings.

Re: Plugin that checks filesystem

Posted: Tue Nov 19, 2013 11:59 am
by slansing
There are some good examples, as well as the usage text for the check_disk plugin here:

https://www.nagios-plugins.org/doc/man/check_disk.html

I'd recommend structuring the check based off of that.

Re: Plugin that checks filesystem

Posted: Tue Nov 19, 2013 1:03 pm
by srikanth.kallu
I think i havent explained my issue correctly

[root@b4sl03 libexec]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LVroot
3.9G 959M 2.8G 26% /
/dev/mapper/VolGroup00-LVusr
3.9G 2.0G 1.7G 55% /usr
/dev/mapper/VolGroup00-LVvar
3.9G 337M 3.4G 9% /var
/dev/mapper/VolGroup00-LVhome
3.9G 1002M 2.7G 27% /home
/dev/mapper/VolGroup00-LVtmp
2.0G 82M 1.8G 5% /tmp
/dev/sda3 99M 27M 68M 28% /boot
tmpfs 48G 0 48G 0% /dev/shm
/dev/mapper/VolGroup00-LVapps
102G 33G 65G 34% /apps
txforge01:/apps/endeca/mouser
217G 161G 45G 79% /forge


[root@b4sl03 libexec]# mkdir /srikanth
[root@b4sl03 libexec]# ./check_disk -w 10% -c 5% -p /srikanth
DISK OK - free space: / 2804 MB (74% inode=98%);| /=958MB;3570;3768;0;3967

Why is it showing usage of the folder /srikanth. I havent mounted it. I think it is assuming as / ?

Re: Plugin that checks filesystem

Posted: Tue Nov 19, 2013 1:09 pm
by tmcdonald
Correct, it is showing you the usage of the root partition. In your df -h output it shows 26% used, and in your check output it shows 74% free, and since this adds up to 100 we can assume that's what is happening. The reason it does not work as you expect is because check_dick does not check a directory for free space (there really isn't such a thing). If you use /srikanth as a mountpoint for a network drive or a local drive, then it will work.

Re: Plugin that checks filesystem

Posted: Tue Nov 19, 2013 1:17 pm
by srikanth.kallu
Ok let me ask it this way.

I have a NFS shared filesystem (/forge). I want to get alert if it gets unmounted or if it inaccessable or anyother NFS stale errors.

How do i do this ?

Please help.

Re: Plugin that checks filesystem

Posted: Tue Nov 19, 2013 1:27 pm
by tmcdonald
Have you tried searching for "NFS" on Nagios Exchange? For example, the check_nfs_stale plugin.

Re: Plugin that checks filesystem

Posted: Tue Nov 19, 2013 3:45 pm
by srikanth.kallu
I have wrote a simple plugin which suits my environment

#!/bin/sh

FILE=/tmp/nfs.txt

df -h | grep mnt > $FILE

if [ -s $FILE ]
then
echo "/mnt is OK"
stateid=0
else
echo "/mnt is missing "
stateid=2
fi
exit $stateid


I have defined this in CCM-->service--> addnew and followed the rest of the procedure.

When i click on test command it works but that serive is not showing in home-->service detail of that paricular host.

What am i missing ? please help.

Re: Plugin that checks filesystem

Posted: Tue Nov 19, 2013 4:14 pm
by sreinhardt
Have you applied configuration? Is this service enabled?