newlines in JSON
Re: newlines in JSON
I've attached the file. The first line ends up in "plugin_output" and the rest of it in "long_plugin_output". Previously I was only including the part in "long_plugin_output", in case you're wondering why there's suddenly an extra line.
- Attachments
-
qstat_output.txt- (1.27 KiB) Downloaded 392 times
Re: newlines in JSON
There aren't any non-ASCII characters in that output that might be breaking things... I am thinking more and more that this is less to do with your plugin output and more to do with the CGIs themselves. Could we maybe get a copy of your qstat_test.pl script, as well as any arguments you might pass to it, or files it operates on? I really want to be able to reproduce this in house so we can help you faster than going back and forth on the forums.
Former Nagios employee
Re: newlines in JSON
That might be difficult. I'll give more details in a PM.
Re: newlines in JSON
I must admit I'm at a loss on this one. I work with perl pretty regularly and there is nothing in that script that should do any modifications, and the plugin output itself is clean, too. Barring some obscure newline parsing bug in the perl modules (which I have looked for) I am leaning more and more toward the CGI. I am going to have a talk with the devs and see if they can provide any input.
Update: What version of Core are you using? There have been some changes made just today actually that dealt with escaping backslashes (of all things).
Update: What version of Core are you using? There have been some changes made just today actually that dealt with escaping backslashes (of all things).
Former Nagios employee
Re: newlines in JSON
it says it's nagios 4.0.7, but it is a patch from git. This is the name of the zip file, I don't know how to translate it to a commit number:
nagioscore-04c80dd834760f3fbd276c616db8266a7f75e687.zip
Would you recommend I grab the latest commit on git?
nagioscore-04c80dd834760f3fbd276c616db8266a7f75e687.zip
Would you recommend I grab the latest commit on git?
Re: newlines in JSON
You can check out a given commit like so:
https://github.com/NagiosEnterprises/na ... 6a7f75e687
Not being a developer I can't say for sure what a commit is doing in it entirety, but it looks like that one definitely does add some newline-handling functionality:
https://github.com/NagiosEnterprises/na ... 3ae539L211
I'd try out the latest master code.
https://github.com/NagiosEnterprises/na ... 6a7f75e687
Not being a developer I can't say for sure what a commit is doing in it entirety, but it looks like that one definitely does add some newline-handling functionality:
https://github.com/NagiosEnterprises/na ... 3ae539L211
I'd try out the latest master code.
Former Nagios employee
Re: newlines in JSON
I have good news and bad news.
The good news is that the latest code fixed the newlines problem! Yay!
The bad news is that it did not print out the whole JSON when we do a query for servicelist.
It just (seemingly) randomly stopped in the middle of printing out one of the services:
(It's a passive check).
I reverted back and it was able to print out the whole query.
And then I went back to the fixed-yet-differently-broken version to check something and it stopped at a different point (also different character count), so it seems like the stopping point is random.
Let me know of any other information I can provide for you.
thanks!
The good news is that the latest code fixed the newlines problem! Yay!
The bad news is that it did not print out the whole JSON when we do a query for servicelist.
It just (seemingly) randomly stopped in the middle of printing out one of the services:
Code: Select all
"check_multipathS115": {
"host_name": "pleiades1",
"description": "check_multipathS115",
"plugin_output": "Service is not scheduled to be checked...",
"long_plugin_output": "",
"perf_data": "",
"max_attemps": 1,
"current_attempt": 1,
"status": 1,
"last_update": 1407272090000,
"has_been_checked": false,
"should_be_scheduled": false,
"last_check": 0,
"check_options": 0,
"check_type": 0,
"checks_enabled": false,
"last_state_change": 0,
"last_hard_state_change": 0,
"last_hard_state": 0,
"last_time_ok": 0,
"last_time_warning": 0,
"last_time_unknown": 0,
"last_time_critical": 0,
"state_type": 1,
"last_notification": 0
I reverted back and it was able to print out the whole query.
And then I went back to the fixed-yet-differently-broken version to check something and it stopped at a different point (also different character count), so it seems like the stopping point is random.
Let me know of any other information I can provide for you.
thanks!
Re: newlines in JSON
We just posted a 4.0.8 release candidate to SourceForge. The latest changes that affect the JSON API directly were on July 28 (https://github.com/NagiosEnterprises/na ... c922de9cfe). If you're running anything newer than that you shouldn't see any difference in the JSON with the release candidate, but testing against the RC will help us to implement fixes.
I think the partial output is a crash in the CGI, and not a logic error deciding to stop writing output. Is it possible to get a core dump from the CGI and the executable itself? Installing the debug binaries with (make install-unstripped) is handy when looking at a dump in a debugger, and makes certain the debug information agrees with the binary.
I think the partial output is a crash in the CGI, and not a logic error deciding to stop writing output. Is it possible to get a core dump from the CGI and the executable itself? Installing the debug binaries with (make install-unstripped) is handy when looking at a dump in a debugger, and makes certain the debug information agrees with the binary.
Re: newlines in JSON
Just an update: I tested the RC and it also crashes. Apparently we do not have core dumps enabled on this system. I'm working with one of the system admins to get them enabled temporarily. I'll let you know if/when I can get you a core dump.
Re: newlines in JSON
Alright. Eric Stanley is in the office today. If you have the core dumps and bin I can pass them directly to him.
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.
"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.