check_nrpe Returning Truncated Performance Data - Followup

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
kichi
Posts: 7
Joined: Tue Jun 23, 2015 5:01 pm

check_nrpe Returning Truncated Performance Data - Followup

Post 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.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_nrpe Returning Truncated Performance Data - Follow

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
kichi
Posts: 7
Joined: Tue Jun 23, 2015 5:01 pm

Re: check_nrpe Returning Truncated Performance Data - Follow

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_nrpe Returning Truncated Performance Data - Follow

Post 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
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.
kichi
Posts: 7
Joined: Tue Jun 23, 2015 5:01 pm

Re: check_nrpe Returning Truncated Performance Data - Follow

Post 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?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: check_nrpe Returning Truncated Performance Data - Follow

Post 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.
kichi
Posts: 7
Joined: Tue Jun 23, 2015 5:01 pm

Re: check_nrpe Returning Truncated Performance Data - Follow

Post 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?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: check_nrpe Returning Truncated Performance Data - Follow

Post 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.
kichi
Posts: 7
Joined: Tue Jun 23, 2015 5:01 pm

Re: check_nrpe Returning Truncated Performance Data - Follow

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_nrpe Returning Truncated Performance Data - Follow

Post by tmcdonald »

I'll be closing this thread now, but feel free to open another if you need anything in the future!
Former Nagios employee
Locked