Skip to content
This repository has been archived by the owner. It is now read-only.

[dev.icinga.com #5217] status output in JSON format not including short and long plugin output properly #1396

Closed
icinga-migration opened this issue Nov 26, 2013 · 16 comments
Labels
Milestone

Comments

@icinga-migration
Copy link
Member

@icinga-migration icinga-migration commented Nov 26, 2013

This issue has been migrated from Redmine: https://dev.icinga.com/issues/5217

Created by ddegois on 2013-11-26 11:03:05 +00:00

Assignee: ricardo
Status: Resolved (closed on 2013-12-03 15:42:13 +00:00)
Target Version: 1.10.2
Last Update: 2014-12-08 09:21:43 +00:00 (in Redmine)

Icinga Version: 1.10.1
OS Version: any

Hello,

It would be nice to have a configuration option to add LONGSERVICEOUTPUT properly escaped in a new fiels of service status overview's JSON output (http://classic.demo.icinga.org/icinga/cgi-bin/status.cgi?host=all&type=detail&servicestatustypes=16&serviceprops=1048576&jsonoutput), no ?

Regards,
Damien

Changesets

2013-12-03 11:22:27 +00:00 by ricardo 7999005

clssic-ui: fix status output in JSON format not including short and long plugin output properly #5217

A stupid logical mistake got fixed. Tested andworked here.

refs: #5217
whatthecommit: Fixed unnecessary bug.

2013-12-03 15:28:55 +00:00 by ricardo b430bb8

Merge branch 'fix/json-long-status-output-5217' into support/1.10

Fixes: #5217

2013-12-04 21:15:09 +00:00 by ricardo 19307be

classic-ui: fix for fix status output in JSON format not including short and long plugin output properly #5217

Newline in JSON and CSV output got double quoted. Actual quoting got moved to
where data is printed.

refs: #5217
whatthecommit: I must have been drunk.

2013-12-04 21:29:21 +00:00 by ricardo 265ebfa

Merge branch 'fix/json-long-status-output-5217' into support/1.10

Fixes: #5217

2013-12-13 12:50:34 +00:00 by ricardo 8e18f34

classic-ui: fix for fix status output in JSON format not including short and long plugin output properly #5217

Newline in JSON and CSV output got double quoted. Actual quoting got moved to
where data is printed.

backport to 1.9

refs: #5217
whatthecommit: I must have been drunk.
@icinga-migration

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Nov 26, 2013

Updated by ddegois on 2013-11-26 11:04:26 +00:00

Sorry I wanted to post it in CORE section :/

My bad. Can somebody move it ?

Regards,
Damien

@icinga-migration

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Nov 26, 2013

Updated by mfriedrich on 2013-11-26 11:05:53 +00:00

  • Project changed from Docs to 19
@icinga-migration

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Nov 26, 2013

Updated by ricardo on 2013-11-26 19:04:14 +00:00

Hello Damien,

you can get this behavior by splitting the string after the first line break if there is any.

example:

status_information "Connection refused\nSMTP CRITICAL - 0.023 sec. response time\ntest123"

$SERVICEOUTPUT$ = Connection refused
$LONGSERVICEOUTPUT$ = SMTP CRITICAL - 0.023 sec. response time\ntest123

And isn't it usually properly escaped?

Cheers Ricardo

@icinga-migration

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Nov 27, 2013

Updated by ddegois on 2013-11-27 01:21:29 +00:00

Hi Ricardo,

I agree but currently, in style=servicedetail or style=hostdetail, status_information contains serviceoutput, not longserviceoutput :)

My suggestion was to add a dedicated key for longserviceoption to avoid breaking compatibility with older softwares and while improving overviews.

My point of view is, as JSON output is more software/API and mostly non-human-reading oriented, to have maximum information in minimum of request might be a good idea, (personal opinion :D ).

Regards,
Damien

@icinga-migration

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Dec 2, 2013

Updated by ricardo on 2013-12-02 22:55:59 +00:00

  • Status changed from New to Feedback

ddegois wrote:

I agree but currently, in style=servicedetail or style=hostdetail, status_information contains serviceoutput, not longserviceoutput :)

In both styles it contains the longserviceoutput (as described in previous post) )as long as you have the cgi.cfg option "status_show_long_plugin_output" switched to 1.

Cheers
Ricardo

@icinga-migration

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Dec 2, 2013

Updated by ddegois on 2013-12-02 23:33:22 +00:00

I've spotted a subtle difference between HTML output and JSON output (on status.cgi in search mode or overview). It seems that on JSON, only the second line is shown.
Using Icinga 1.10.1 and status_show_long_plugin_output=1

In HTML table, the Status information call contains:
OK - Certificate will expire on 05/22/2014 03:00.
SSMTP OK - 0.233 second response time on port 465 [220 xxxx.xxxx.xxx ESMTP]

On the JSON output, the "status_information" key contains only the second line:
SSMTP OK - 0.233 second response time on port 465 [220 xxxx.xxxx.xxx ESMTP]

Did I miss something ?

Regards,
Damien

@icinga-migration

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Dec 3, 2013

Updated by mfriedrich on 2013-12-03 08:01:24 +00:00

long output is always considered the 2..n lines of the output. the html formatting just presents the \n in a familiar manner (
).

http://docs.icinga.org/latest/en/pluginapi.html#outputspec

not only the cgis behave that way, also the internal column attributes are populated like so.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Dec 3, 2013

Updated by ddegois on 2013-12-03 08:43:01 +00:00

I agree but status information in HTML table shows both lines, I was expecting the same behavior on JSON output.
In JSON we simply lose the first line :/

Regards,
Damien

@icinga-migration

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Dec 3, 2013

Updated by ricardo on 2013-12-03 09:02:17 +00:00

This should NOT happen. ;-) (I'm at stage 3 of the 6 stages of debugging)

I will have a look at it. (proceeding to 4)

@icinga-migration

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Dec 3, 2013

Updated by ddegois on 2013-12-03 09:04:04 +00:00

So maybe it could be an option to have both in JSON, short as usual and long in a different key ?

@icinga-migration

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Dec 3, 2013

Updated by ricardo on 2013-12-03 10:26:50 +00:00

  • Subject changed from _LONGSERVICEOUTPUT in status.cgi _ to status output in JSON format not including short and long plugin output properly
  • Category set to 78
  • Assigned to set to ricardo
  • Target Version set to 1.10.2

Stage 5 and 6 now ;-)

@icinga-migration

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Dec 3, 2013

Updated by ricardo on 2013-12-03 11:20:31 +00:00

  • Tracker changed from Feature to Bug
  • Icinga Version set to 1
  • (unknown custom field) set to all
@icinga-migration

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Dec 3, 2013

Updated by ricardo on 2013-12-03 15:36:30 +00:00

Is your problem fixed with commit 7999005 ??

@icinga-migration

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Dec 3, 2013

Updated by ricardo on 2013-12-03 15:42:13 +00:00

  • Status changed from Feedback to Resolved
  • Done % changed from 0 to 100

Applied in changeset icinga-core:b430bb827782f0c1b4e3934fb85b285be25191cf.

@icinga-migration

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Dec 3, 2013

Updated by ddegois on 2013-12-03 16:54:26 +00:00

Sorry for the delay, looks good, thanks :)

Regards,
Damien

@icinga-migration

This comment has been minimized.

Copy link
Member Author

@icinga-migration icinga-migration commented Dec 8, 2014

Updated by mfriedrich on 2014-12-08 09:21:43 +00:00

  • Project changed from 19 to Core, Classic UI, IDOUtils
  • Category changed from 78 to Classic UI
  • OS Version set to any
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.