Page 1 of 1

Check Disk for all mounted UNIX filesystems

Posted: Fri May 18, 2018 11:35 am
by awilson
Hello. We have a requirement to monitor disk space use on every mounted filesystem on Linux and AIX systems. To date, we've been configuring individual checks for each filesystem that is of interest. The case we need to catch is if a filesystem is added or removed, the UNIX team wants us to automatically catch the altered configuration.

There is a script in the Nagios plugins set that does this for WIndows, but I haven't found anything on the net for UNIX.

We are using nrpe with a check_disk shell script so we can use the same one for Linux and AIX. Will it work to use a wrapper script to loop through a set of mounted filesystems substituting the check_disk filesystem parameter on each iteration to launch /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -t 30 -c check_disk -a '-w 80 -c 90 -p $filesystem'?

I ask because I recall an earlier posting where we were told that there were limitations on executing nrpe from within another nrpe script. What are the constraints and considerations that we should cover?

If for example Nagios XI initiates an ../check_nrpe -H remotehost -t 30 -c check_multiple_filesystems -a '-w 85 -c 95 -p all' and the remotehost's check_multiple_filesystems scripts iterates through launching nrpe -c check_disk -a '-w $warnarg -c $critarg -p $currentfs' will Nagios XI know what to do with the results from the remotely launched checks, when it didn't initiate them?

Thanks! Alan

Re: Check Disk for all mounted UNIX filesystems

Posted: Fri May 18, 2018 3:06 pm
by npolovenko
Hi, @awilson.
will Nagios XI know what to do with the results from the remotely launched checks, when it didn't initiate them
It will not so what you need to do is put a generic definition in the nrpe.cfg file on the remote server.

Code: Select all

command[check_filesystems]=/usr/local/nagios/libexec/check_disk -w 80 -c 90 -p $ARG1$
Then from the Nagios server run a script that will loop through the nrpe command with multiple -p parameters and render the output.

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H host_ip_address -c check_filesystems -a '$filesystem'
Then your script needs to automatically create new service checks for the new filesystems. You can find some examples here:
https://old.nagios.org/developerinfo/ex ... ndlist.php

This seems like a lot of work to implement, but also how would XI distinguish when something bad happened to a filesystem and when the filesystem simply doesn't exist/or was removed?

Re: Check Disk for all mounted UNIX filesystems

Posted: Mon May 21, 2018 11:22 am
by mcapra
Have you tried using the native disk check functionality in NCPA?

I think with a secondary script that compares the output NCPA's disk/logical or disk/mount endpoint against a locally held cache, you should be able to accomplish everything you want to do:
https://www.nagios.org/ncpa/help.php#api-modules-disk

Re: Check Disk for all mounted UNIX filesystems

Posted: Tue May 22, 2018 10:18 am
by kyang
Thanks for the help @mcapra!

awilson, Let us know if you have any more questions after looking at these options.

Re: Check Disk for all mounted UNIX filesystems

Posted: Thu May 31, 2018 7:05 pm
by awilson
We'll test out NCPA. Perhaps we'll migrate.
You can close this.

Re: Check Disk for all mounted UNIX filesystems

Posted: Fri Jun 01, 2018 9:12 am
by kyang
No problem.

Closing now.

Feel free to open a new forum thread if you have any more issues.