Page 1 of 1

NRPE: Unable to read output

Posted: Wed May 06, 2020 6:50 am
by Pratapa
Hi,

We wrote a script on the client machine which is a Linux server.
When we execute the script at command prompt it is giving correct result.

[root@host1 tmp]# sh /usr/lib64/nagios/plugins/ce/check_blocking_sessions.sh
No blocking sessions

We defined it in /etc/nagios/nrpe.cfg file as follows
command[check_blocking_sessions]=/usr/lib64/nagios/plugins/ce/check_blocking_sessions.sh

When we invoke the script from Nagios server, we are getting following error

[root@nagios libexec]# ./check_nrpe -H host1 -c check_blocking_sessions
NRPE: Unable to read output


Later we add sudo to the following

command[check_blocking_sessions]=sudo /usr/lib64/nagios/plugins/ce/check_blocking_sessions.sh

and made an entry in /etc/sudoers
nagios ALL= NOPASSWD: /usr/lib64/nagios/plugins/ce/check_blocking_sessions.sh

no requiretty defined in /etc/sudoers

[root@host1 ce]# cat /etc/sudoers|grep requiretty
[root@host1 ce]#

but no luck.

Ofcourse, we restarted nrpe daemon whenever me made changes in nrpe.cfg file.

Following are the directory and file permissions.

[root@host1 ce]# ls -ld /usr/lib64/nagios/plugins/ce/
drwxr-xr-x. 1 root root 210 May 5 17:00 /usr/lib64/nagios/plugins/ce/

[root@host1 ce]# ls -l /usr/lib64/nagios/plugins/ce/check_blocking_sessions.sh
-rwxr-xr-x. 1 root root 634 May 5 16:58 /usr/lib64/nagios/plugins/ce/check_blocking_sessions.sh

Where we went wrong?

Re: NRPE: Unable to read output

Posted: Wed May 06, 2020 3:43 pm
by jbrunkow
Did you add the Nagios user to the sudoers?

Code: Select all

nagios ALL=(ALL) NOPASSWD:/usr/lib/nagios/plugins/additional/check_openmanage
Please refer to the following help article for more possible causes. Is there anything in that article that you haven't considered?
https://support.nagios.com/kb/article/n ... t-620.html

Re: NRPE: Unable to read output

Posted: Thu May 07, 2020 5:42 am
by Pratapa
[quote="jbrunkow"]Did you add the Nagios user to the sudoers?

Code: Select all

nagios ALL=(ALL) NOPASSWD:/usr/lib/nagios/plugins/additional/check_openmanage
Following is the entry in /etc/sudoers file

nagios ALL= NOPASSWD: /usr/lib64/nagios/plugins/ce/check_blocking_sessions.sh

Re: NRPE: Unable to read output

Posted: Sun May 10, 2020 8:11 pm
by raosri1992
I'm having same problems. Custom scripts works fine on the Remote server on which NRPE agent is installed. When I try to invoke the scripts from nagios server I'm getting same error.

I trying this scripts https://github.com/colebrooke/kubernetes-nagios

Let me know if you get an answer for this.

Re: NRPE: Unable to read output

Posted: Sun May 10, 2020 8:27 pm
by raosri1992
HI Pratap,

Which version of NRPE agent are you running?

Thanks,
Srikanth

Re: NRPE: Unable to read output

Posted: Sun May 10, 2020 9:20 pm
by raosri1992
Pratapa wrote:
jbrunkow wrote:Did you add the Nagios user to the sudoers?

Code: Select all

nagios ALL=(ALL) NOPASSWD:/usr/lib/nagios/plugins/additional/check_openmanage
Following is the entry in /etc/sudoers file

nagios ALL= NOPASSWD: /usr/lib64/nagios/plugins/ce/check_blocking_sessions.sh

##############My Analysis######33

I'm having similar problem. I have tested these scripts https://github.com/colebrooke/kubernetes-nagios using NRPE 4.0.3 and NRPE 3.2.1

What is the root cause, can anyone help us.