Page 1 of 1

NRPE: Unable to read output

Posted: Thu Nov 21, 2019 3:40 pm
by exp-user1
Hello team,

could you please help in the following error output: (some other checks are working fine for the same client)

from Nagios server:
[root@nagios libexec]# ./check_nrpe -H 1.1.1.1 -t 220 -c check_comand -a arg1 5 10
NRPE: Unable to read output

check_command contain sudo and is working fine from client side with nagios user.


is there a way to debug and get verbose output from check_nrpe tool?

Re: NRPE: Unable to read output

Posted: Thu Nov 21, 2019 5:45 pm
by benjaminsmith
Hi,

A few things verify. Is the path to the plugin correctly defined correctly in the nrpe.cfg on the remote host?

Also, if this plugin requires sudo privileges to run, you'll need to modify the /etc/sudoers file to grant access. Step-by-step instructions can be found in the following guide.

NRPE - NRPE: Unable To Read Output

Re: NRPE: Unable to read output

Posted: Fri Nov 22, 2019 4:04 pm
by exp-user1
Hi,

every thing is set correctly but the script contain a line like:

VAR=`sudo docker exec --user="username" -ti container_id bash -c "/command_inside_contianer" | awk '{print $1}'`

so in local host it gives a correct output and the script is working fine.

it seems like nagios is unable to execute commands inside docker even though i have sudoer entry for nagios and nagios is in docker group. (knowing that the script is working fine from nagios user session also) only when call it from nagios check_nrpe it gives "unable to read outpur"

any idea?
is there any debugging tool for check_nrpe to see what's going on, like bash -x for shell script.?

thank you.

Re: NRPE: Unable to read output

Posted: Mon Nov 25, 2019 10:49 am
by benjaminsmith
Hi @exp-user1,

When you are running the check locally, are you logged in as the nagios or root? Can you upload the nrpe configuration file for us to review (
/usr/local/nagios/etc/nrpe.cfg )? Thanks.

Also, please try test again using the full path in the command string?

Re: NRPE: Unable to read output

Posted: Mon Nov 25, 2019 3:49 pm
by exp-user1
thank you,

it's working now, the problem was in docker command itself.

Regards.

Re: NRPE: Unable to read output

Posted: Mon Nov 25, 2019 3:52 pm
by benjaminsmith
Hello,

Super! Glad you were able to get it worked out.

I'll close this out. If you have any new questions, feel free to open another post.

Thank you for using the Nagiso Support Forum!