Check Disk for all mounted UNIX filesystems

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
awilson
Posts: 224
Joined: Mon Mar 21, 2016 1:20 pm

Check Disk for all mounted UNIX filesystems

Post 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
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Check Disk for all mounted UNIX filesystems

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Check Disk for all mounted UNIX filesystems

Post 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
Former Nagios employee
https://www.mcapra.com/
kyang

Re: Check Disk for all mounted UNIX filesystems

Post by kyang »

Thanks for the help @mcapra!

awilson, Let us know if you have any more questions after looking at these options.
awilson
Posts: 224
Joined: Mon Mar 21, 2016 1:20 pm

Re: Check Disk for all mounted UNIX filesystems

Post by awilson »

We'll test out NCPA. Perhaps we'll migrate.
You can close this.
kyang

Re: Check Disk for all mounted UNIX filesystems

Post by kyang »

No problem.

Closing now.

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