Page 1 of 1

check_nrpe Returning Truncated Performance Data - Followup

Posted: Thu Jul 16, 2015 5:59 pm
by kichi
I was reading this thread:
https://support.nagios.com/forum/viewto ... 16&t=30449

I was trying to create a separate nrpe/check_nrpe called nrpe_large/check_nrpe_large.

I made the changes stated in the other thread:
./include/common.h:#define MAX_INPUT_BUFFER 4096 /* max size of most buffers we use */
./include/common.h:#define MAX_PACKETBUFFER_LENGTH 4096 /* max amount of data we'll send in one query/response */
./contrib/nrpe_check_control.c:#define MAX_CHARS 4096

I put nrpe_large in /usr/local/nagios/bin and check_nrpe_large in /usr/local/nagios/libexec.

I'm using RHEL 6 (64-bit) and xinetd. I made a copy of nrpe (nrpe_large) in /etc/xinetd.d which references nrpe_large. I restarted the xinetd service. I'm running this on itself (Nagios server) and get the following:

[root@NAGIOS_TEST libexec]# ./check_nrpe -H NAGIOS_TEST
NRPE v2.15
[root@NAGIOS_TEST libexec]# ./check_nrpe_large -H NAGIOS_TEST
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

/var/log/messages contains:
Jul 16 22:40:21 NAGIOS_TEST xinetd[10398]: START: nrpe pid=10526 from=::ffff:10.10.10.233
Jul 16 22:40:21 NAGIOS_TEST nrpe[10526]: Error: Request packet had invalid CRC32.
Jul 16 22:40:21 NAGIOS_TEST nrpe[10526]: Client request was invalid, bailing out...
Jul 16 22:40:21 NAGIOS_TEST xinetd[10398]: EXIT: nrpe status=0 pid=10526 duration=0(sec)

Any suggestions?

Thanks.

Re: check_nrpe Returning Truncated Performance Data - Follow

Posted: Thu Jul 16, 2015 11:44 pm
by Box293
I want to confirm that you compiled these changes on both the nrpe listening server and the nagios server executing the check_nrpe_large.

Re: check_nrpe Returning Truncated Performance Data - Follow

Posted: Fri Jul 17, 2015 9:23 am
by kichi
As a test I'm running check_nrpe_large on itself, the Nagios server (root@NAGIOS_TEST), no nrpe listening server. However, I can try to put it on a machine that's running the nrpe listener. Maybe executing as user nagios would be different? check_nrpe -H seems to work fine returning the nrpe version. I'd expect check_nrpe_large -H to do the same.

Re: check_nrpe Returning Truncated Performance Data - Follow

Posted: Fri Jul 17, 2015 9:31 am
by abrist
Both check_nrpe, and the remote nrpe daemon need to be patched. Just a heads up, I have a branch on my github with payload size changes. Build it on the remote host and on the nagios server:
https://github.com/abrist/nrpe/tree/payload_size

Re: check_nrpe Returning Truncated Performance Data - Follow

Posted: Fri Jul 17, 2015 11:44 am
by kichi
OK. I'll make the changes from your source code. Thanks.

I'm trying to test the change on my virtual machine on itself to get the version information as a response, no remote host. So it sounds like I just need to update the local nrpe and check_nrpe. If I'm using nrpe through xinetd, is there any additional steps I need to take?

Re: check_nrpe Returning Truncated Performance Data - Follow

Posted: Fri Jul 17, 2015 12:26 pm
by jdalrymple
Nope.

It truly sounds like the only steps you missed is that both ends need to be updated. Once you recompile both bits, nrpe & check_nrpe, and place them your check should work A-OK. xinetd doesn't matter in this case, you won't even have to restart any daemons if you're using xinetd.

Re: check_nrpe Returning Truncated Performance Data - Follow

Posted: Fri Jul 17, 2015 6:59 pm
by kichi
OK I got it working. My next question: Only data in $SERVICEOUTPUT$ is contained in the event log. Is there any way to save the $LONGSERVICEOUTPUT$ to a text log file?

Re: check_nrpe Returning Truncated Performance Data - Follow

Posted: Mon Jul 20, 2015 10:05 am
by jdalrymple
There is no easy way. You could create a separate log file and use an obsessive command to write it. Adding the $LONGSERVICEOUTPUT$ to an obsessive command or a notification is trivial. Modifying the internal logging options would be difficult, there are no runtime configurations for it besides debugging:

Code: Select all

# DEBUG LEVEL
# This option determines how much (if any) debugging information will
# be written to the debug file.  OR values together to log multiple
# types of information.
# Values:
#          -1 = Everything
#          0 = Nothing
#          1 = Functions
#          2 = Configuration
#          4 = Process information
#          8 = Scheduled events
#          16 = Host/service checks
#          32 = Notifications
#          64 = Event broker
#          128 = External commands
#          256 = Commands
#          512 = Scheduled downtime
#          1024 = Comments
#          2048 = Macros
You could try to add in 16 and that may give you what you want.

Are you sure you want to log (up to) 4K lines of data? On an even medium sized system that's going to result in some pretty hefty log files pretty quick.

Re: check_nrpe Returning Truncated Performance Data - Follow

Posted: Tue Jul 21, 2015 6:07 pm
by kichi
I ended up writing a wrapper routine around check_nrpe that sends the data to a file when the status is not OK. I'll only be using this for the service that I need to maintain the $LONGSERVICEOUTPUT$ data.

I think that solves my issue. Thanks for all of your help.

Re: check_nrpe Returning Truncated Performance Data - Follow

Posted: Wed Jul 22, 2015 9:07 am
by tmcdonald
I'll be closing this thread now, but feel free to open another if you need anything in the future!