NRPE:Unable to read output

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
snapon_admin
Posts: 952
Joined: Mon Jun 10, 2013 10:39 am
Location: Kenosha, WI
Contact:

Re: NRPE:Unable to read output

Post by snapon_admin »

Sounds good, thanks man.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NRPE:Unable to read output

Post by abrist »

Well, here are my results, looks like it works in my test, although, I am using a clone of the source right from github:

Code: Select all

yum install git -y
cd /tmp
git clone http://github.com/NagiosEnterprises/nrpe.git
cd nrpe
Edit the file nrpe.c by changing lines 1389-1390 to:

Code: Select all

else if(!strcmp(buffer,"")) {
    snprintf(buffer,sizeof(buffer)-1,"NRPE: Unable to read output\n");
    result=STATE_UNKNOWN;
}
Run configure with command args:

Code: Select all

./configure --enable-command-args
make
make install
Run your check that fails and then check the exit code:

Code: Select all

echo $?
The results of my tests (I broke the command path in nrpe.cfg):

Code: Select all

[root@nagiosxi nrpe]# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_users -a '-w 5'
NRPE: Unable to read output
[root@nagiosxi nrpe]# echo $?
3
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
snapon_admin
Posts: 952
Joined: Mon Jun 10, 2013 10:39 am
Location: Kenosha, WI
Contact:

Re: NRPE:Unable to read output

Post by snapon_admin »

Code: Select all

[root@nagiosTEST tmp]# git clone http://github.com/NagiosEnterprises/nrpe.git
Initialized empty Git repository in /tmp/nrpe/.git/
error: Failed connect to github.com:443; Operation now in progress while accessing http://github.com/NagiosEnterprises/nrpe.git/info/refs

fatal: HTTP request failed
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: NRPE:Unable to read output

Post by slansing »

Do you have a proxy set up between this server and the outside world? You might need to configure your get installation for that proxy with something like:

Code: Select all

git config --global http.proxy http://myuser:mypassword@myproxy:8080
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NRPE:Unable to read output

Post by abrist »

Oops, dropped the "s" from the protocol. My apologies. Github requires ssl:

Code: Select all

git clone https://github.com/NagiosEnterprises/nrpe.git
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
snapon_admin
Posts: 952
Joined: Mon Jun 10, 2013 10:39 am
Location: Kenosha, WI
Contact:

Re: NRPE:Unable to read output

Post by snapon_admin »

It was proxy, completely forgot about that. Ok, so i got through all the steps this time, and the lines I needed to modify lined up with yours exactly, but after running the config and make commands it still returns exit 1.

Code: Select all

[root@nagiosTEST nrpe]# /usr/local/nagios/libexec/check_nrpe -p 5668 -H INCORRECTGLOBAL.snapon.com -c check_zone_cpu -a '-n ZONE -w 80 -c 90'
NRPE: Unable to read output
[root@nagiosTEST nrpe]# echo $?
1
Redacted server and zone names.What I'm doing to break it is checking the cpu utilization on a zone, but using the wrong global name. Gives me the 'Unable to read' I'm looking for, but not the right error code. Here's the modified lines:

Code: Select all

else if(!strcmp(buffer,"")) {
    snprintf(buffer,sizeof(buffer)-1,"NRPE: Unable to read output\n");
    result=STATE_UNKNOWN;
}
Config and make commands go through without issue:

Code: Select all

[root@nagiosTEST nrpe]# ./configure --enable-command-args
checking for a BSD-compatible install... /usr/bin/install -c
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking whether make sets $(MAKE)... yes
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking whether time.h and sys/time.h may both be included... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking ctype.h usability... yes
checking ctype.h presence... yes
checking for ctype.h... yes
checking dirent.h usability... yes
checking dirent.h presence... yes
checking for dirent.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking grp.h usability... yes
checking grp.h presence... yes
checking for grp.h... yes
checking for inttypes.h... (cached) yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking pwd.h usability... yes
checking pwd.h presence... yes
checking for pwd.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking for stdint.h... (cached) yes
checking for strings.h... (cached) yes
checking for string.h... (cached) yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking tcpd.h usability... no
checking tcpd.h presence... no
checking for tcpd.h... no
checking for unistd.h... (cached) yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking socket.h usability... no
checking socket.h presence... no
checking for socket.h... no
checking for sys/types.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking for sys/wait.h... (cached) yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking for sys/stat.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for mode_t... yes
checking for pid_t... yes
checking for size_t... yes
checking return type of signal handlers... void
checking for uid_t in sys/types.h... yes
checking type of array argument to getgroups... gid_t
checking for int... yes
checking size of int... 4
checking for short... yes
checking size of short... 2
checking for long... yes
checking size of long... 8
checking for uint32_t... yes
checking for u_int32_t... yes
checking for int32_t... yes
checking for va_copy... yes
checking for vsnprintf... yes
checking for snprintf... yes
checking for asprintf... yes
checking for vasprintf... yes
checking for C99 vsnprintf... yes
checking for getopt_long... yes
checking for main in -lnsl... yes
checking for socket in -lsocket... no
checking for main in -lwrap... no
checking for strdup... yes
checking for strstr... yes
checking for strtoul... yes
checking for initgroups... yes
checking for closesocket... no
checking for socklen_t... yes
checking for type of socket size... size_t
checking for SSL headers... SSL headers found in /usr
checking for SSL libraries... SSL libraries found in /usr/lib64

*** Generating DH Parameters for SSL/TLS ***
Generating DH parameters, 512 bit long safe prime, generator 2
This is going to take a long time
..................................+..................+....+...........+....+.....+.............+......................................+.....................................+...........................++*++*++*++*++*++*
checking for Kerberos include files... could not find include files
checking for perl... /usr/bin/perl
configure: creating ./config.status
config.status: creating Makefile
config.status: creating subst
config.status: creating src/Makefile
config.status: creating package/solaris/Makefile
config.status: creating init-script
config.status: creating init-script.debian
config.status: creating init-script.suse
config.status: creating nrpe.spec
config.status: creating sample-config/nrpe.cfg
config.status: creating sample-config/nrpe.xinetd
config.status: creating include/config.h
config.status: include/config.h is unchanged


*** Configuration summary for nrpe 2.15 09-06-2013 ***:

 General Options:
 -------------------------
 NRPE port:    5666
 NRPE user:    nagios
 NRPE group:   nagios
 Nagios user:  nagios
 Nagios group: nagios


Review the options above for accuracy.  If they look okay,
type 'make all' to compile the NRPE daemon and client.

[root@nagiosTEST nrpe]# make
cd ./src/; make ; cd ..
make[1]: Entering directory `/tmp/nrpe/src'
gcc -g -O2 -I/usr/include/openssl -I/usr/include -DHAVE_CONFIG_H -I ../include -I ./../include -o nrpe ./nrpe.c ./utils.c ./acl.c -L/usr/lib64  -lssl -lcrypto -ln
make[1]: Leaving directory `/tmp/nrpe/src'

*** Compile finished ***

If the NRPE daemon and client compiled without any errors, you
can continue with the installation or upgrade process.

Read the PDF documentation (NRPE.pdf) for information on the next
steps you should take to complete the installation or upgrade.

[root@nagiosTEST nrpe]# make install
cd ./src/ && make install
make[1]: Entering directory `/tmp/nrpe/src'
make install-plugin
make[2]: Entering directory `/tmp/nrpe/src'
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/libexec
/usr/bin/install -c -m 775 -o nagios -g nagios check_nrpe /usr/local/nagios/libexec
make[2]: Leaving directory `/tmp/nrpe/src'
make install-daemon
make[2]: Entering directory `/tmp/nrpe/src'
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/bin
/usr/bin/install -c -m 775 -o nagios -g nagios nrpe /usr/local/nagios/bin
make[2]: Leaving directory `/tmp/nrpe/src'
make[1]: Leaving directory `/tmp/nrpe/src'
But then the exit code is wrong (shown above), so....yeah, lol.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NRPE:Unable to read output

Post by abrist »

Did you restart the xinetd service to load the new bin for the daemon after "make install"?

Code: Select all

service xinetd restart
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
snapon_admin
Posts: 952
Joined: Mon Jun 10, 2013 10:39 am
Location: Kenosha, WI
Contact:

Re: NRPE:Unable to read output

Post by snapon_admin »

I did not, however I just redid all the steps and included restarting xinetd after 'make install' and got the same result.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NRPE:Unable to read output

Post by abrist »

So strange. Are there any other nrpe daemons running (outside of xinetd)?

Code: Select all

ps -aef | grep "nrpe\|xinetd" 
I am at a loss at this point. Could it be time to open a ticket for a remote?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
snapon_admin
Posts: 952
Joined: Mon Jun 10, 2013 10:39 am
Location: Kenosha, WI
Contact:

Re: NRPE:Unable to read output

Post by snapon_admin »

this means no right?

Code: Select all

[root@nagiosTEST src]# ps -aef | grep "nrpe\|xinetd"
root     33362     1  0 10:50 ?        00:00:00 xinetd -stayalive -pidfile /var/run/xinetd.pid
root     56565 32854  0 12:24 pts/1    00:00:00 grep nrpe\|xinetd
As for the ticket, I assume that might be where this is headed. I have no idea why this doesn't seem to be working.
Locked