Nagios: How to Enable check_nrpe Command Line Arguments

Question: When I execute check_nrpe command with some arguments, I get the message “CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.”. How do I fix this issue?

Answer: The issue is very straight forward. check_nrpe doesn’t take any arguments by default. You should enable the command line arguments for check_nrpe as shown below.

Verify the check_nrpe error message

Just for testing purpose, let us assume that you are execuing the following check_nrpe command that displays the “CHECK_NRPE: Received 0 bytes from daemon.” error message.

If you view the /var/log/messages on the remote host, (in the above example, that is 192.168.1.20), you’ll see the nrpe error “Error: Request contained command arguments!” as shown below, indicating that check_nrpe is not enabled to take the command arguments.

Enable check_nrpe command arguments

To enable command arguments in NRPE, you should do the following two things.

1. Configure NRPE with –enable-command-args

Typically when you install NRPE on the remote host, you’ll do ./configure without any arguments. To enable support for command arguments in the NRPE daemon, you should install it with –enable-command-args as shown below.

This is unbelievable. I went through the whole hassle of installing the system through all these make commands and then making an RPM so I could distribute nagios to about 45 machines, ONLY to find out I need to go through the whole process again if I want the command arguments. Why wouldn’t this be built in by default?

Well, right now I have the problem described at the top of the page, when I’m trying to run the check_nrpe command and gives me that error. I’m doing exactly what you say here running:
[remotehost]# ./configure –enable-command-args
[remotehost]# make all
[remotehost]# make install-plugin

But in the beggining I need to say where are the ssl libraries with this
./configure –enable-command-args –with-ssl=/usr/opt/freeware/lib

that finish ok, but when I just type “make all” gives me the next error:
[remotehost]# make all
cd ./src/; make ; cd ..
gcc -g -O2 -I/usr/include/openssl -I/usr/include -DHAVE_CONFIG_H -c ./snprintf.c
In file included from /usr/include/fcntl.h:188,
from ./../include/config.h:143,
from ./snprintf.c:108:
/usr/include/unistd.h:935: error: expected ‘)’ before ‘[‘ token
/usr/include/unistd.h:936: error: expected declaration specifiers or ‘…’ before ‘rid_t’
make: 1254-004 The error code from the last command is 1.

About The Geek Stuff

My name is Ramesh Natarajan. I will be posting instruction guides, how-to, troubleshooting tips and tricks on Linux, database, hardware, security and web. My focus is to write articles that will either teach you or help you resolve a problem. Read more about Ramesh Natarajan and the blog.