Page 1 of 1

One service to monitor df on multiple hosts

Posted: Mon May 03, 2021 7:32 am
by Sargento
Hello,

I've read through much of the documentation and I'm at a point where I need some help from a professional.

So here's the issue. Say you had the same mount on a handful of servers, we can call it /cheese. When I do the mount check in the XI wizard, this service is unable to be ran on more than one server and is configured to the initial server you run the wizard on. How can I make a single service that will monitor /cheese and see if /cheese is hanging and add it to an entire group of servers.

I don't want to have 10 servers in a group and have 10 of the same services to check for the /cheese mount.

Thank you

Re: One service to monitor df on multiple hosts

Posted: Mon May 03, 2021 12:18 pm
by dchurch
The "Mountpoint" wizard currently only supports monitoring mountpoints on the server the plugin is run on. If you go thru the wizard, it sets up a service that monitors a local mountpoint on the Nagios XI machine, but adds it as a service attached to the host you give it. Not too useful if you ask me.

Are you currently running NCPA on any of these servers?

I ask because we can use some trickery to ask NCPA to execute the "check_mountpoints.sh" script on the remote server (the one that ships with Nagios XI, and checks local mountpoints). See Using Scripts / Plugins With NCPA.

If you've done all that and have the check actually working on the remote, let me know and I'll help you apply it to a range of servers.

Re: One service to monitor df on multiple hosts

Posted: Mon May 03, 2021 2:27 pm
by Sargento
We do plan on using NCPA very soon.

Re: One service to monitor df on multiple hosts

Posted: Mon May 03, 2021 3:59 pm
by dchurch
What you would do for each host is upload check_mountpoints.sh into /usr/local/ncpa/plugins/, set it as executable, call it using this as an example:

Code: Select all

Command name: check_xi_ncpa
Command     : $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
ARG1        : -t 'mytoken' -P 5693  -M 'plugins/check_mountpoints.sh' -q 'args=/path/to/mountpoint -i -w'
NCPA also has some built-in checks for mount points that will give even better data, such as free space.

Re: One service to monitor df on multiple hosts

Posted: Thu May 06, 2021 9:19 am
by Sargento
I will consider this. The default wizard for mount points has caused us some issues and your option may be better.

Re: One service to monitor df on multiple hosts

Posted: Thu May 06, 2021 9:51 am
by Sargento
dchurch wrote:What you would do for each host is upload check_mountpoints.sh into /usr/local/ncpa/plugins/, set it as executable, call it using this as an example:

Code: Select all

Command name: check_xi_ncpa
Command     : $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
ARG1        : -t 'mytoken' -P 5693  -M 'plugins/check_mountpoints.sh' -q 'args=/path/to/mountpoint -i -w'
NCPA also has some built-in checks for mount points that will give even better data, such as free space.

When I run the above check with the correct token and mount point for this server I get the response "nagios utils.sh not found"

Re: One service to monitor df on multiple hosts

Posted: Thu May 06, 2021 3:49 pm
by dchurch
Copy /usr/local/nagios/libexec/utils.sh onto the remote server as /opt/nagios/plugins/utils.sh and it should work.

Re: One service to monitor df on multiple hosts

Posted: Fri May 07, 2021 9:07 am
by Sargento
That location for utils.sh did not work; however, when I created and put the utils.sh file into /opt/nagios/libexec, it did work. After digging through the mount check plugin I see that the plugin is looking for the utils.sh script in the below locations:

/opt/nagios/libexec
/usr/lib64/nagios/plugins
/usr/lib/nagios/plugins
/usr/local/nagios/libexec
/usr/local/icinga/libexec
/usr/local/libexec
/opt/csw/libexec/nagios-plugins

So I can put the utils.sh file in any of these or append the script the look in any directory I want. FYI I just unmounted a directory and received a failed message, it works perfect!

Thank you for your help!

Re: One service to monitor df on multiple hosts

Posted: Fri May 07, 2021 3:24 pm
by dchurch
Glad to hear you resolved it! Locking thread.

If you have any additional issues, feel free to make a new thread.