I set up a monitoring service on a linux host with check_nrpe_mount (attached image of the service). On a brand new set up host on Nagios (5.6.14 version btw) this returns "NRPE: Command 'check_mountpoints' not defined".
The check_mountpoints.sh file is in /usr/local/nagios/libexec/ but not under the nagios user - its under root. Is this a permission issue and how can I resolve that? I would need to replicate this process and monitor mounts on a lot more hosts so please advice what is the best solution to this.
Issues with setting check_mountpoints on linux server
-
kostadin.boychev
- Posts: 4
- Joined: Thu Jun 18, 2020 4:19 pm
Issues with setting check_mountpoints on linux server
You do not have the required permissions to view the files attached to this post.
Re: Issues with setting check_mountpoints on linux server
The check_nrpe plugin is usually used for monitoring remote machines, on which NRPE agent is installed. So the check_mountpoints command must be defined on the client (remote box) in the common.cfg file or in the nrpe.cfg file.
The common.cfg file is added when you install the Linux agent (NRPE + Nagios Plugins) via our official installer. See the document below:
https://assets.nagios.com/downloads/nag ... _Agent.pdf
If you compiled NRPE from source, you won't have common.cfg on the client. In this case, you can define it in the nrpe.cfg file. You could define the command in any of these two files. Dont' forget to restart the NRPE daemon, so that changes can take effect.
If the /usr/local/nagios/libexec/check_mountpoints.sh script requires root privileges, you would need to use sudo in your command, and add nagios to your sudoers file.
Tips: First, test the command locally on the remote machine, just to make sure it works. Then, you could test it from the Nagios XI server.
Let us know if you get stuck on something. Thanks!
The common.cfg file is added when you install the Linux agent (NRPE + Nagios Plugins) via our official installer. See the document below:
https://assets.nagios.com/downloads/nag ... _Agent.pdf
If you compiled NRPE from source, you won't have common.cfg on the client. In this case, you can define it in the nrpe.cfg file. You could define the command in any of these two files. Dont' forget to restart the NRPE daemon, so that changes can take effect.
If the /usr/local/nagios/libexec/check_mountpoints.sh script requires root privileges, you would need to use sudo in your command, and add nagios to your sudoers file.
Tips: First, test the command locally on the remote machine, just to make sure it works. Then, you could test it from the Nagios XI server.
Code: Select all
/usr/local/nagios/libxec/check_nrpe -H <client ip> -c check_mountpoints -a '<some args if any>'Be sure to check out our Knowledgebase for helpful articles and solutions!
-
kostadin.boychev
- Posts: 4
- Joined: Thu Jun 18, 2020 4:19 pm
Re: Issues with setting check_mountpoints on linux server
Hello really banging my head on this one.
Defined in common.cfg
### Check Mount
command[check_mountpoints]=/usr/local/nagios/libexec/check_mountpoints.sh $ARG1$
Now I am getting : NRPE: Unable to read output error instead.
Tried using check_mountpoint instead of check_nrpe_mount and I get :
CRITICAL: /mnt/jupyterpersonal/ doesn't exist in fstab /etc/fstab ; /mnt/jupyterpersonal/ is not mounted ; /mnt/jupyterpersonal/ doesn't exist on filesystem ;
Which would be wonderful if it was true but based on cat /etc/fstab/ and using mount I can see that it is mounted.
Running sudo /usr/local/nagios/libexec/check_mountpoints.sh /insertmountname/ works on the other server that I have it configured and on this one it just returns command not found. If I try the one you described it returns command not found for check_nrpe with sudo rights used.
Went through the configuration wizard which set up check_mountpoint which again returns that nothing is mounted even though the mounts are there.
Any service that monitors works with me as soon as it is working properly and I can replicate on more servers.
Defined in common.cfg
### Check Mount
command[check_mountpoints]=/usr/local/nagios/libexec/check_mountpoints.sh $ARG1$
Now I am getting : NRPE: Unable to read output error instead.
Tried using check_mountpoint instead of check_nrpe_mount and I get :
CRITICAL: /mnt/jupyterpersonal/ doesn't exist in fstab /etc/fstab ; /mnt/jupyterpersonal/ is not mounted ; /mnt/jupyterpersonal/ doesn't exist on filesystem ;
Which would be wonderful if it was true but based on cat /etc/fstab/ and using mount I can see that it is mounted.
Running sudo /usr/local/nagios/libexec/check_mountpoints.sh /insertmountname/ works on the other server that I have it configured and on this one it just returns command not found. If I try the one you described it returns command not found for check_nrpe with sudo rights used.
Went through the configuration wizard which set up check_mountpoint which again returns that nothing is mounted even though the mounts are there.
Any service that monitors works with me as soon as it is working properly and I can replicate on more servers.
Re: Issues with setting check_mountpoints on linux server
You are running your command with "sudo", but the one, defined in the common.cfg doesn't have "sudo"...Running sudo /usr/local/nagios/libexec/check_mountpoints.sh /insertmountname/ works on the other server that I have it configured and on this one it just returns command not found.
Let see if the command produces the same output when run as root and as nagios user. Can you run the following commands on the remote Linux server, and show the output?command[check_mountpoints]=/usr/local/nagios/libexec/check_mountpoints.sh $ARG1$
Code: Select all
sudo /usr/local/nagios/libexec/check_mountpoints.sh /<mountname>
su - nagios -c "/usr/local/nagios/libexec/check_mountpoints.sh /<mountname>"Restart NRPE (if it's running as a standalone daemon) or xinetd on the client (remote system).
Test your command from the Nagios XI server:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H <client ip> -c check_mountpoints -a '</<mountname>'Be sure to check out our Knowledgebase for helpful articles and solutions!
-
kostadin.boychev
- Posts: 4
- Joined: Thu Jun 18, 2020 4:19 pm
Re: Issues with setting check_mountpoints on linux server
Thanks for the timely replies!
I got back to the issue and tested your recommendations.Ran as root command returns the exact same result. Don't really know the nagios password and switching to nagios user using root privileges still requires to input password when executing a command.
On the other server actually in the common.cfg its defined as
### Check Mount
command[check_mountpoints]=/usr/local/nagios/libexec/check_mountpoint_servername
and check_mountpoint_servername is set by sudo /usr/local/nagios/libexec/check_mountpoints.sh /insertmountname/
In the end that is not what I desire as I want to check all mounts not just hard coded one.Do you think that I should wipe the configs and start from scratch and if that is the case what would be the process? Define check_mountpoint? Use a different script?
Thank you,
Kostadin
I got back to the issue and tested your recommendations.Ran as root command returns the exact same result. Don't really know the nagios password and switching to nagios user using root privileges still requires to input password when executing a command.
On the other server actually in the common.cfg its defined as
### Check Mount
command[check_mountpoints]=/usr/local/nagios/libexec/check_mountpoint_servername
and check_mountpoint_servername is set by sudo /usr/local/nagios/libexec/check_mountpoints.sh /insertmountname/
In the end that is not what I desire as I want to check all mounts not just hard coded one.Do you think that I should wipe the configs and start from scratch and if that is the case what would be the process? Define check_mountpoint? Use a different script?
Thank you,
Kostadin
Re: Issues with setting check_mountpoints on linux server
It shouldn't ask you for a password if you added nagios to sudoers file on the client (remote machine). Make sure you have the following lines in sudoers file:Don't really know the nagios password and switching to nagios user using root privileges still requires to input password when executing a command.
Code: Select all
Defaults:nagios !requiretty
nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_mountpoints.sh *You can just try a different plugins, e.g. check_disk. Add the following line to the common.cfg file on the client:In the end that is not what I desire as I want to check all mounts not just hard coded one.Do you think that I should wipe the configs and start from scratch and if that is the case what would be the process? Define check_mountpoint? Use a different script?
Code: Select all
command[check_mounts]=/usr/local/nagios/libexec/check_disk -lTest the new command from the CLI on the Nagios XI server:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H <client ip> -c check_mountsCode: Select all
[root@main-nagios-xi ~]# /usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_mounts
DISK OK - free space: / 26950 MiB (75.36% inode=89%); /dev/shm 3936 MiB (100.00% inode=100%); /boot 325 MiB (72.09% inode=100%);| /=8810MiB;;;0;37674 /dev/shm=0MiB;;;0;3936 /boot=125MiB;;;0;476Code: Select all
/usr/local/nagios/libexec/check_disk -hhttps://exchange.nagios.org/directory/Plugins
Once you find something that you think might work, test it, and add a new command and service by following the document below:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Be sure to check out our Knowledgebase for helpful articles and solutions!