[bug + workaround] worker truncates svc long output at 20kB

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
marek.kaminski.1112
Posts: 3
Joined: Tue Oct 21, 2014 5:17 am

[bug + workaround] worker truncates svc long output at 20kB

Post by marek.kaminski.1112 »

Dear All,

I've found a bug in Nagios Core 4.0.20130912 related to treating service check's long output (denoted also as long_output or long_plugin_output) by worker processes.

I have an active check returning a little bit over 20kB of long output.
It turned out that, on random basis, the output was either delivered to nagios completely or (in majority of cases) truncated exactly at 20kB.

According to documentation, increasing MAX_PLUGIN_OUTPUT_LENGTH (nagios-4.0.20130912/include/nagios.h) + recompilation should help.
But the hint worked for me only in Nagios 3.2.2. Not in 4.0.20130912.

So beside increasing it, I've also increased adequately MAX_EXTERNAL_COMMAND_LENGTH (nagios-4.0.20130912/include/common.h) as I was advised to do so in comment above definition of MAX_PLUGIN_OUTPUT_LENGTH. It did not help too but I did not remove these changes and dig further.

During my investigation I've ensured that in my case the problem did not lie in low ulimits.

Fortunately and finally, thank God :-) I've managed to work the problem around and I wanted to share the attached patch with you.
The workaround consists in modifying size of char buffer named buf from 4096 to 40960 (in body of static void function named gather_output).

I hope it will help someone.

Best regards,
Marek Kaminski [ marek.kaminski.1112 (at) gmail.com ]
Attachments
worker.c.nagios-4.0.20130912.patch
(413 Bytes) Downloaded 332 times
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: [bug + workaround] worker truncates svc long output at 2

Post by ssax »

Thank you for posting your solution, I'm sure future visitors who run into the same issues will appreciate it!
Locked