I have a problem with nagios and NRPE and I can't resolve it.
I've already tried.
# grep "nrpe_user=" /etc/nagios/nrpe.cfg
nrpe_user=nrpe
NRPE is running as the user nrpe. So I added this lines to visudo:
Defaults:nrpe !requiretty
nrpe ALL=(ALL) NOPASSWD: /usr/lib64/nagios/plugins/check_jboss_files
I edited my nagios nrpe.cfg:
command[check_jboss_files]=sudo /usr/lib64/nagios/plugins/check_jboss_files
But if I try to run the command from the Nagios server I get the following:
# /usr/lib64/nagios/plugins/check_nrpe -H 1.2.3.4 -c check_jboss_files
NRPE: Unable to read output
The script was running as expected when launched locally, even when running as user nrpe:
# sudo sudo -s -u nrpe
bash-4.2$ sudo /usr/lib64/nagios/plugins/check_jboss_files
JBOSS Files: 2049
WARNING - JBOSS Files: 2049
Without sudo the script is working on nagios server, but must work with sudo to give good results. What I missed? I've probably tried everything and I will be grateful for any help.