NRPE: Unable to read output
Posted: Wed May 06, 2020 6:50 am
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?
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?