NRPE: Unable to read output

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Pratapa
Posts: 150
Joined: Tue Oct 01, 2019 1:33 am

NRPE: Unable to read output

Post 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?
User avatar
jbrunkow
Posts: 441
Joined: Fri Mar 13, 2020 10:45 am

Re: NRPE: Unable to read output

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Pratapa
Posts: 150
Joined: Tue Oct 01, 2019 1:33 am

Re: NRPE: Unable to read output

Post 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
raosri1992
Posts: 14
Joined: Thu May 07, 2020 8:46 am

Re: NRPE: Unable to read output

Post 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.
raosri1992
Posts: 14
Joined: Thu May 07, 2020 8:46 am

Re: NRPE: Unable to read output

Post by raosri1992 »

HI Pratap,

Which version of NRPE agent are you running?

Thanks,
Srikanth
raosri1992
Posts: 14
Joined: Thu May 07, 2020 8:46 am

Re: NRPE: Unable to read output

Post 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.
Locked