Page 1 of 1

CHECK_NRPE: Receive header underflow - only 0 bytes received (4 expected)

Posted: Sat Apr 13, 2024 2:23 pm
by pnikhade
Hi All,

I had installed Nagios core on EC2 instance and when trying to check load on the remote server, I am getting the below response by executing the command,

./check_nrpe -H 13.201.39.252 -c check_load -a -w .15,.10,.05 -c .30,.25,.20
CHECK_NRPE: Receive header underflow - only 0 bytes received (4 expected).

I read somewhere to run --enable-command-args with ./configure but still not working. Any ideas so as to resolve this ?

Thanks,
Piyush Nikhade

Re: CHECK_NRPE: Receive header underflow - only 0 bytes received (4 expected)

Posted: Mon Apr 15, 2024 2:23 pm
by danderson
Thanks for reaching out @pnikhade,

I found this article especially helpful
https://assets.nagios.com/downloads/nag ... e/NRPE.pdf

I was able to replicate your issue and resolve it. You have two options.

Enable Command Line Arguments
Open up /usr/local/nagios/etc/nrpe.cfg or wherever the nrpe configuration is on the remote server you are trying to check
Go to the commands section. You'll see a line like so

Code: Select all

command[check_load]=/usr/local/nagios/libexec/check_load -r -w .15,.10,.05 -c .30,.25,.20
Change this to

Code: Select all

command[check_load]=/usr/local/nagios/libexec/check_load $ARG1$
Then, go to a line that looks like so

Code: Select all

dont_blame_nrpe=0
Change it to

Code: Select all

dont_blame_nrpe=1
Restart the nrpe service and try again.

The main issue with this is that it is inherintely insecure because any plugin can effectively control the shell. This is why it's recommended to

Alter the Command In the Configuration File
Instead of changing the check_load command to include $ARG1$, simply update the command line arguments in the config file to be what you want

Code: Select all

command[check_load]=/usr/local/nagios/libexec/check_load -w .15,.10,.05 -c .30,.25,.20
In this case you won't have to edit anything, and the check command would now be

Code: Select all

./check_nrpe -H 13.201.39.252 -c check_load
Let me know if you need any more help

Re: CHECK_NRPE: Receive header underflow - only 0 bytes received (4 expected)

Posted: Fri May 10, 2024 12:00 am
by jehofem507
danderson wrote: Mon Apr 15, 2024 2:23 pm Thanks for reaching out @pnikhade,

I found this article especially helpful
https://assets.nagios.com/downloads/nag ... e/NRPE.pdf

I was able to replicate your issue and resolve it. You have two options.

Enable Command Line Arguments
Open up /usr/local/nagios/etc/nrpe.cfg or wherever the nrpe configuration is on the remote server you are trying to check
Go to the commands section. You'll see a line like so

Code: Select all

command[check_load]=/usr/local/nagios/libexec/check_load -r -w .15,.10,.05 -c .30,.25,.20
Change this to

Code: Select all

command[check_load]=/usr/local/nagios/libexec/check_load $ARG1$
Then, go to a line that looks like so

Code: Select all

dont_blame_nrpe=0
Change it to

Code: Select all

dont_blame_nrpe=1
Restart the nrpe service and try again.

The main issue with this is that it is inherintely insecure because any plugin can effectively control the shell uno online. This is why it's recommended to

Alter the Command In the Configuration File
Instead of changing the check_load command to include $ARG1$, simply update the command line arguments in the config file to be what you want

Code: Select all

command[check_load]=/usr/local/nagios/libexec/check_load -w .15,.10,.05 -c .30,.25,.20 
In this case you won't have to edit anything, and the check command would now be

Code: Select all

./check_nrpe -H 13.201.39.252 -c check_load
Let me know if you need any more help
Thanks, it helps.