Has multiline (LONGOUTPUT) changed in 4.x ?

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
simon1485
Posts: 4
Joined: Tue Aug 19, 2014 5:48 am

Has multiline (LONGOUTPUT) changed in 4.x ?

Post by simon1485 »

Hi Nagios Devas,

I upgraded a 3.51 to 4.08 and my passive checks which use LONGOUTPUT to transmit many lines are now being interpreted as peformance data ie. the multiline is concatenated on to the performance data.

Has the format changed in 4.x? I reverted to 3.51 and all is fine again.

Here's my debug:

echo "[1408524453] PROCESS_HOST_CHECK_RESULT;TESTHOST;OK;HELLO WORLD|pfdata=47s;10;20;;\naline1\naline2\nline3\nline4" > /usr/local/nagios/var/rw/nagios.cmd

On 3.5 this displays as:

Status Information: HELLO WORLD
aline1
aline2
line3
line4
Performance Data: pfdata=47s;10;20;;


But, nagios 4.08

Status Information: HELLO WORLD
Performance Data: pfdata=47s;10;20;;\naline1\naline2\nline3\nline4


Any ideas appreciated.
Thanks
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Has multiline (LONGOUTPUT) changed in 4.x ?

Post by abrist »

There may have been an undocumented change to the way perfdata is handled. My tests show that everything (including text on newlines) after the pipe is now considered perfdata. You can still output multiple lines, but the perfdata has to be at the end. Does this agree with what you have experienced?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
simon1485
Posts: 4
Joined: Tue Aug 19, 2014 5:48 am

Re: Has multiline (LONGOUTPUT) changed in 4.x ?

Post by simon1485 »

Thanks for replying. Yes that's how it looks to me also.

I did check the manual expecting to see a change, but didn't.

I was hoping that since manual hadn't changed it was a bug, I've a whole stack of remote hosts that send data passive in this way...Upgrade nightmare :(
simon1485
Posts: 4
Joined: Tue Aug 19, 2014 5:48 am

Re: Has multiline (LONGOUTPUT) changed in 4.x ?

Post by simon1485 »

Actually, looking at it more closely I can't get it to work with the multiline output even in this format:

echo "[1408610612] PROCESS_HOST_CHECK_RESULT;TESTHOST;OK;HELLO WORLD\nline1\nline2\nline3\nline4|pfdata=47s;10;20;;" > /usr/local/nagios/var/rw/nagios.cmd

Superficially it looks ok, the perf data is in the right place. However, the multilines are just extensions of the first status line and the GUI expands to show them

May be I'm missing something simple?

Thanks for your time.
emislivec
Posts: 52
Joined: Tue Feb 25, 2014 10:06 am

Re: Has multiline (LONGOUTPUT) changed in 4.x ?

Post by emislivec »

simon1485 wrote:Actually, looking at it more closely I can't get it to work with the multiline output even in this format:

echo "[1408610612] PROCESS_HOST_CHECK_RESULT;TESTHOST;OK;HELLO WORLD\nline1\nline2\nline3\nline4|pfdata=47s;10;20;;" > /usr/local/nagios/var/rw/nagios.cmd

Superficially it looks ok, the perf data is in the right place. However, the multilines are just extensions of the first status line and the GUI expands to show them

May be I'm missing something simple?

Thanks for your time.
You're doing everything right, this is a bug.

Core should be unescaping backslash (\\) and newline (\n) sequences in plugin output it reads from nagios.cmd. I'll have a fix committed soon.

Thanks for reporting this.
simon1485
Posts: 4
Joined: Tue Aug 19, 2014 5:48 am

Re: Has multiline (LONGOUTPUT) changed in 4.x ?

Post by simon1485 »

Thanks!!
emislivec
Posts: 52
Joined: Tue Feb 25, 2014 10:06 am

Re: Has multiline (LONGOUTPUT) changed in 4.x ?

Post by emislivec »

This should be fixed with commit a34073f.

If you want to give it a try you can use the current master from GitHub: https://github.com/NagiosEnterprises/na ... master.zip

Thanks again.
Locked