≑ Menu

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.

$ /usr/local/nagios/libexec/check_nrpe -H 192.168.1.20 -c check_disk -a 60 80 /dev/sdb1
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

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.

$ tail -f /var/log/messages
Dec 5 11:11:52 dev-db xinetd[2536]: START: nrpe pid=24187 from=192.168.101.108
Dec 5 11:11:52 dev-db nrpe[24187]: Error: Request contained command arguments!
Dec 5 11:11:52 dev-db nrpe[24187]: Client request was invalid, bailing out...
Dec 5 11:11:52 dev-db xinetd[2536]: EXIT: nrpe status=0 pid=24187 duration=0(sec)

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.

[remotehost]# tar xvfz nrpe-2.12.tar.gz
[remotehost]# cd nrpe-2.12

[remotehost]# ./configure --enable-command-args

[remotehost]# make all
[remotehost]# make install-plugin
[remotehost]# make install-daemon
[remotehost]# make install-daemon-config
[remotehost]# make install-xinetd

2. Modify nrpe.cfg and set dont_blame_nrpe

Modify the /usr/local/nagios/etc/nrpe.cfg on the remote server and set the dont_blame_nrpe directive to 1 as shown below.

$ /usr/local/nagios/etc/nrpe.cfg
dont_blame_nrpe=1

Execute check_nrpe with command arguments

After the above two changes, if you execute the check_nrpe for this particular remote host, you’ll not see the error message anymore as shown below.

$ /usr/local/nagios/libexec/check_nrpe -H 192.168.1.20 -c check_disk -a 60 80 /dev/sdb1
DISK OK - free space: / 111199 MB (92% inode=99%);| /=9319MB;101662;114370;0;127078

Security Warning

Enabling NRPE command line arguments is a security risk. If you don’t know what you are doing, don’t enable this.

Probably by now you’ve already figured out that you can’t blame NRPE if something goes wrong. After all you did set dont_blame_nrpe to 1.

Add your comment

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

Comments on this entry are closed.

  • Chris Jefferies May 16, 2012, 11:55 am

    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?

    Isn’t life filled with enough tedium?

  • Pravin June 11, 2012, 6:15 am

    There is no need to re-compile package. If you are using debian packge the argument support can be just enabled by making dont_blame_nrpe=1 in nrpe.cfg file

    Cheers..

  • Richard Lynch June 15, 2012, 8:54 am

    @Chris Jefferies
    It’s not enabled by default because it’s a SECURITY VULNERABILITY.

    That’s why it’s called “dont_blame_nrpe”

    If you turn it on, and nrpe command arguments are used to break into your computer:

    “Don’t Blame NRPE”

    You turned it on.

    You are responsible for the consequences.

    If you don’t understand the risks and consequences, don’t turn it on.
    (If you don’t understand a contract, don’t sign it.)

  • vedaprasad September 18, 2012, 5:30 am

    Dosen’t work for me . i have dont_blame_nrpe=1 but still getting the same error ..

    [root@guest1 global]# /usr/local/nagios/libexec/check_nrpe -H 192.168.229.130 -c check_load -a 20 30
    CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
    ————————————————————————————————–

    Sep 18 22:29:53 nagclient nrpe[1824]: Handling the connection…
    Sep 18 22:29:53 nagclient nrpe[1824]: Error: Request contained command arguments!

  • Anonymous September 26, 2012, 9:17 am

    on the remote host
    ./configure –enable-command-args

  • Matt Yakel July 2, 2014, 9:02 am

    I had to add echo “nrpe 5666/tcp # nrpe” to the /etc/services file as well. To get rid of this error. Thanks for the post πŸ™‚

  • Diego Alejandro October 24, 2014, 11:10 am

    Hi All

    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.

    Stop.
    make: 1254-004 The error code from the last command is 2.

    Stop.

    any suggestions would be apreciated!!! any help, please??