Navigation Menu

Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

[dev.icinga.com #2380] epn truncates perfdata output to 4096 bytes #896

Closed
icinga-migration opened this issue Feb 29, 2012 · 8 comments
Closed

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/2380

Created by tontonitch on 2012-02-29 16:06:47 +00:00

Assignee: tontonitch
Status: Closed (closed on 2012-08-19 14:29:49 +00:00)
Target Version: (none)
Last Update: 2012-08-19 14:29:49 +00:00 (in Redmine)

Icinga Version: 1.6.1
OS Version: RHEL

Hi,

I've discovered that epn truncates the performance data to 4094 bytes + "\n" at the end. (might be more generally the output)
So every perl plugins returning a certain amount of data are impacted and cannot be used with epn.

Workaround is of course the "# nagios: -epn" flag to add at the top of the script plugin.

Might be also interesting to have epn accepting longer output when the value of MAX_PLUGIN_OUTPUT_LENGTH (icinga.h) has been modified at the compilation time.

Br,
Yannick

Attachments


Relations:

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2012-04-04 15:48:40 +00:00

  • Project changed from Icinga 1.x to Core, Classic UI, IDOUtils

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2012-04-19 22:46:20 +00:00

  • Status changed from New to Feedback
  • Target Version deleted 1.7

what does the debuglog say, when you raise verbosity to checks? it must trigger that output parts in the code.

                                log_debug_info(DEBUGL_CHECKS, 1, "Embedded Perl ran %s: return code=%d, plugin output=%s\n", fname, pclose_result, (perl_plugin_output == NULL) ? "NULL" : checkresult_dbuf.buf);

@icinga-migration
Copy link
Author

Updated by tontonitch on 2012-04-26 12:11:24 +00:00

  • File added check_test.pl
  • File added epn_enabled.png
  • File added epn_disabled.png
  • File added icinga.debug

Hi Michael,
I wrote a small script check_test.pl to easily debug this issue (attached).
Attached are 2 screenshots of the status details of the corresponding check:

epn enabled:
epn_enabled.png

epn disabled:
epn_disabled.png

When epn is enabled (no #nagios -epn), attached is the full debug corresponding to that test check (icinga.debug). You can see that, if you look for the "Embedded Perl ran" debug line, you will see a truncated result.

Br,
Yannick

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2012-05-13 17:26:47 +00:00

  • Category set to Embedded Perl
  • Status changed from Feedback to Assigned
  • Assigned to set to mfriedrich

thanks, i need to take some time and look deeper into that. put on my todo list. if it unveils a bug, it may hit the 1.7.x bugfix tree after deep testing.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2012-07-06 16:40:04 +00:00

hm, i think this happens within the p1.pl file itsself, when the perl stdout is piped to the inner PRINT/F functions.

=item * Capturing output from the Perl program being run

This framework ties STDOUT to a scalar that stores the result of PRINT or PRINTF.

maybe try to modify the hardcoded values to substr, and test again. but i have no idea which other issues this may cause on embedded perl itsself.

sub PRINT {
        my $self = shift;
        # $$self = substr(join('',@_), 0, 256) ;
        $$self .= substr(join('',@_), 0, 4096) ;
}

sub PRINTF {
        my $self = shift;
        my $fmt = shift;
        # $$self = substr(sprintf($fmt,@_), 0, 256) ;
        $$self .= substr(sprintf($fmt,@_), 0, 4096) ;
}

keep in mind that p1.pl is generated by configure, out of p1.pl.in

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2012-07-31 19:20:47 +00:00

  • Assigned to changed from mfriedrich to tontonitch

@icinga-migration
Copy link
Author

Updated by tontonitch on 2012-08-19 13:57:04 +00:00

Changing the hardcoded substr worked, allowing longer output / performance data.
Ex:

sub PRINT {
        my $self = shift;
        # $$self = substr(join('',@_), 0, 256) ;
        # $$self .= substr(join('',@_), 0, 4096) ;
        $$self .= substr(join('',@_), 0, 32768) ;
}
sub PRINTF {
        my $self = shift;
        my $fmt = shift;
        # $$self = substr(sprintf($fmt,@_), 0, 256) ;
        # $$self .= substr(sprintf($fmt,@_), 0, 4096) ;
        $$self .= substr(sprintf($fmt,@_), 0, 32768) ;
}

These values should fit at least to the MAX_PLUGIN_OUTPUT_LENGTH variable (icinga.h). However, that MAX_PLUGIN_OUTPUT_LENGTH variable is often changed when using plugin generating long outputs.
Maybe something can be done during the generation of p1.pl to adapt that values?

At least the problem is solved.

Regards,
Yannick

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2012-08-19 14:29:49 +00:00

  • Status changed from Assigned to Closed
  • Icinga Version set to 1
  • OS Version set to RHEL

i pretty much dislike those static buffers requiring re-compiling at all. a superior solution should be found in that case, also allowing embedded $language not to cut buffers.

i'll leave that as a documented known bug here
https://wiki.icinga.org/display/testing/Known+Bugs

and close the issue, as you have it documented now, and we can keep it in mind for future icinga versions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant