Right to the point.
NRPE.CFG Modifications:
Added Nagios Host to Allowed:
allowed_hosts=127.0.0.1,192.168.1.10
Removed # in front of command_prefix=/usr/bin/sudo
After that i have reloaded the service.
/etc/init.d/nagios-nrpe-server restart
I have also edited /etc/sudoers
# User privilege specification root ALL=(ALL:ALL) ALL nagios ALL=NOPASSWD: /usr/lib/nagios/plugins/
Running:
$ ./check_users -w 5 -c 10 USERS OK - 1 users currently logged in |users=1;5;10;0
Works and i get my results
Running:
su nagios -c "./check_users -c 2 -w 2"
Resolves in nothing.
From the Nagios host to the new remote system i can run:
check_nrpe -H 192.168.1.20
And i get NPRE v2.12
as result.
I have checked so to that Nagios is owner to the plugin folder but still no go.
Any tips would be helpful.
(and yes i have googled and read a 10-20 threads but still no go)
It seems to me that you don't have the "requiretty" line in your
sudoers
files, make sure you have the following line there:It's meaning is that nagios user (only) is not required to have a tty to run a command which is why I suspect your command fails.
If you're not sure which user runs nagios you can check it in the configuration file which is usually located in
/etc/nagios/nrpe.cfg
.If I had experienced this issue I'd want to first make sure that nagios user is able to successfully run the command and in order to do that I'd enable nagios user's ability to log into the machine by editing it's line in
/etc/passwd
from:to:
Then, I'd
su - nagios
to continue my troubleshooting and then, after solving the issue I'd change this line back to/bin/false
.Please, check if the nrpe process is exactly killed when you restart the service. I used to have the same issue. Use:
to check if the process is still runnning and then:
command to kill it manually.
Are you able to successfully execute the check_users with sudo (as the user running nrpe)? ie.
By any chance, does CentOS have requiretty at the top of the sudoers file? If so, that's the likely culprit. You could try temporarily disabling it globally, or just disable it for the nagios user.
Possibly problem with nagios user. Please check whether nagios user have rights to execute the plugins or not.
plugin permissions shoud be like :