Upgraded to Nagios XI 2014R2.0: newline problem

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Ton Verstegen
Posts: 8
Joined: Thu Jul 26, 2012 8:10 am

Upgraded to Nagios XI 2014R2.0: newline problem

Post 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
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

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

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
jwelch
Posts: 225
Joined: Wed Sep 05, 2012 12:49 pm

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

Post 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.
Ton Verstegen
Posts: 8
Joined: Thu Jul 26, 2012 8:10 am

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

Post 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
You do not have the required permissions to view the files attached to this post.
jwelch
Posts: 225
Joined: Wed Sep 05, 2012 12:49 pm

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

Post 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)?
Ton Verstegen
Posts: 8
Joined: Thu Jul 26, 2012 8:10 am

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

Post 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....
jwelch
Posts: 225
Joined: Wed Sep 05, 2012 12:49 pm

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

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post by lmiltchev »

Ton Verstegen, have you tried jwelch's suggestion? Are you using modgearman or livestatus in your environment?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Ton Verstegen
Posts: 8
Joined: Thu Jul 26, 2012 8:10 am

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

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

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

Post 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?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked