Page 1 of 2

Upgraded to Nagios XI 2014R2.0: newline problem

Posted: Fri Jan 02, 2015 6:05 am
by Ton Verstegen
Hi,

after upgrading from Nagios XI 2012R2.7 to Nagios XI 2014R2.0 I experience the following problem.
Most of our check-output is in multiline-format, lines being separated by "\n". This worked like a charm until the upgrade. Why?

I've searched the Forums for this and checked logfiles, but cannot finding anything that's is telling me why this escape-sequence is not being translated by the XI gui any more. It just remains plain text, eg "CRITICAL\nThe load...."
Can anybody help me understand why this is so and how to fix it??

Thanx,
Ton Verstegen

Nagiox XI 2014R2.0
Nagios Core 4.08
MkLivestatus 1.2.6p1

Re: Upgraded to Nagios XI 2014R2.0: newline problem

Posted: Fri Jan 02, 2015 11:14 am
by tgriep
What check plugin are you using and it's version?
Could you post how the check command is setup, what the output looks like in XI and also from the command line?

Re: Upgraded to Nagios XI 2014R2.0: newline problem

Posted: Sat Jan 03, 2015 3:04 pm
by jwelch
Exactly where do you see the problem? (and what does it look like?...screenshot would help)
examples: the Operations Center 'Status Information' field, the 'Service Status Detail' screen,
the notification email subject/body...etc...
I think there was a major nagios version change between your versions so that may have
something to do with it. I know there were problems with nagios handling of newline characters
as a summary/detail separator in the early 4.0x versions.
Some of our checks produce a lot of detail output and it's easier for me to put <pre> in front
of the details and follow it with </pre> so I don't have to use HTML formatting and worry
about how it looks on the screen vs email.

Re: Upgraded to Nagios XI 2014R2.0: newline problem

Posted: Mon Jan 05, 2015 4:14 am
by Ton Verstegen
@jwelch and tgriep:
The problem occurs with every check, not just one. And it shows in all the NagiosXI-screens.
See the attachment for screen prints of the problem. There you can see how the "\n" is not being used as a new line sequence anymore.
Btw: I did not change anything in the configuration of our plugins (about 3000 in 2 systems); the problem started to show right after the upgrade.

Ton

Re: Upgraded to Nagios XI 2014R2.0: newline problem

Posted: Mon Jan 05, 2015 5:56 am
by jwelch
That *looks* like the symptoms of a problem in Nagios 4 (4.03?) where the newline character was
not recognized as a detail data separator. But that was fixed sometime between 4.05 and 4.08.
Can you verify your nagios version?
Also, are these normal checks (as opposed to check by ssh or something where the output is
generated remotely and special chars may need to be escaped)?

Re: Upgraded to Nagios XI 2014R2.0: newline problem

Posted: Mon Jan 05, 2015 6:35 am
by Ton Verstegen
I saw the fix as well. It has been fixed in 4.0.7 and I am using 4.0.8 (checked it again).
=> Summary: Nagios 4.0.5 no longer honors \n as a separator for summary and detail data for passive checks
=> reported on 22-05-2014 by .... jwelch

And yes, we use a lot of self written checks/plugins that use "\n" in the result-field.
Mostly to supply some more extra info in the NagiosXI-screen.

But it used to work like a charm....

Re: Upgraded to Nagios XI 2014R2.0: newline problem

Posted: Mon Jan 05, 2015 9:59 am
by jwelch
I'd start by trying a simple multiline check script. I put an example in another thread:
http://support.nagios.com/forum/viewtop ... 10#p113905

Give that script a try and see if it shows the problem. If you see correct multi-line ouput,
then there may be something in the way you are generating the output and passing it to nagios
which doesn't work in the newer versions.

Re: Upgraded to Nagios XI 2014R2.0: newline problem

Posted: Mon Jan 05, 2015 4:22 pm
by lmiltchev
Ton Verstegen, have you tried jwelch's suggestion? Are you using modgearman or livestatus in your environment?

Re: Upgraded to Nagios XI 2014R2.0: newline problem

Posted: Tue Jan 06, 2015 5:32 am
by Ton Verstegen
This is really getting interesting: your perl-script works!
But most of my scripts are written for bash and they don't.

The output is ok if I do separate echo's like:

Code: Select all

echo "OK - ${UITVOER}|${UITVOERPERF}"
echo "<pre>"
echo "This is line 1."
echo "This is line 2."
echo "This is line 3."
echo "</pre>"
But most of my checks are output-strings using \n within, like:

Code: Select all

UITVOEREXTRALL="This is line 1.\nThis is line 2.\nThis is line 3."
And now the \n is NOT being translated.


Ton
BTW I'm using livestatus

Re: Upgraded to Nagios XI 2014R2.0: newline problem

Posted: Tue Jan 06, 2015 11:27 am
by sreinhardt
If you are sending the chars \n and not a newline char to nagios, I would not expect it to replace that with an actual newline. When you are variablizing your strings, and then echo-ing them, are you using echo -e $string?