Page 1 of 1
empty lines in plug-in output
Posted: Mon Jun 13, 2016 11:29 am
Hi all,
I recently moved from Nagios 3 to 4 and the first thing I noticed was that empty lines are translated to "\n".
So this test plugin
Code: Select all
#!/bin/sh
echo TEST
echo line 1
echo line 2
echo
echo line 4
exit 0
produces this output
I couldn't find anything online about this behaviour. Is this a bug or a feature and if the latter can it be turned off?
Thanks,
Eli
Re: empty lines in plug-in output
Posted: Mon Jun 13, 2016 3:33 pm
by rkennedy
I spoke with one of our developers, and he informed me that it shouldn't be converting a new line to \n. Could you file an issue for this on our GitHub?
https://github.com/NagiosEnterprises/nagioscore/issues
Re: empty lines in plug-in output
Posted: Mon Jun 13, 2016 3:37 pm
by tmcdonald
Confirmed on 4.1.1
Re: empty lines in plug-in output
Posted: Wed Jun 15, 2016 8:19 am
by eloyd
I'm slow today. Can someone tell me how this matters? I thought plugins should only be outputting one line anyway?
Re: empty lines in plug-in output
Posted: Wed Jun 15, 2016 9:14 am
by tmcdonald
Should, but it is not required:
Starting with version 3, Nagios will process plugins' multiline output, which should be formatted as:
SERVICE STATUS: First line of output | First part of performance data
Any number of subsequent lines of output, but note that buffers
may have a limited size | Second part of performance data, which
may have continuation lines, too
https://nagios-plugins.org/doc/guidelines.html#AEN33
I can think of good reasons why multi-line output might be needed (multiple disk/mount checks in one service (ugly but sometimes desired), event logs that return the log contents, a service which writes out the lyrics to Another Brick In The Wall, etc.) but in general I agree with the one-line thing. The issue here is that it appears to be showing a literal
\n as two characters, instead of converting to
<br />[/icode for display] or something. I vaguely recall an option to define this behavior, but I might be thinking of the CGI config option to allow HTML tags.
At any rate, C dev confirm buggy behavior so it'll be addressed. If we don't hear from OP I'll be filing this on their behalf.
Re: empty lines in plug-in output
Posted: Wed Jun 15, 2016 9:18 am
by eloyd
Thanks. I'll have to go look at that. I'm especially interested in seeing what happens with multi-line perf data.
Re: empty lines in plug-in output
Posted: Wed Jun 15, 2016 4:27 pm
by tmcdonald
I'll get this filed tomorrow, and update accordingly!
Update: Ran into some more pressing matters, but it looks like someone beat me to it:
https://github.com/NagiosEnterprises/na ... issues/137