Json cgi output breaks when..

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
caskov
Posts: 3
Joined: Tue May 26, 2015 6:36 pm

Json cgi output breaks when..

Post by caskov »

Hello..

I have a setup a nagios server to monitor our streaming services.. what we have today is not flexible enough, and it looks like nagios is..

The way i do the tests is to load a master.m3u8 file, and then look through it for content, if content is found the plugin reports all ok, master.m3u8 could not be loaded it reports 404 not found, and then theres the final option, which is really what we need most, but sadly also what breaks the json output it would seem, We often see that the stream is working OK, but either the primary or backup streams will go down.. to check for this i regex through the master.m3u8 file and look for all bitrates and primary and backup streams, if either is missing i output the enitre content of the master.m3u8 file to "long_plugin_output" if one or two alerts fail and the master.m3u8 is loaded into long_plugin_output all is well, but during my testing i forced 16 streams to fail (by making nagios regx for the wrong word) and this prompted the json to fail.. the json will just end at random points..

In the error log of the apache this is logged: http://pastebin.com/DPpnwipD

ive tested this on two differnt Centos 6.6 VM's with plenty of memory and CPU, ive tested it with 4.0.8 and 4.1.0RC all with the same results.

The clear workaround for me is ofcoruse to shave off the content of master.m3u8 file and only display what i need, however id really like to just be able to throw everything into the alert, and seeing as this all works fine in the nagios gui i figured it should work into json too.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Json cgi output breaks when..

Post by ssax »

Comparing the long_plugin_output with where the json is ending, are there any specific characters that it is breaking on?
caskov
Posts: 3
Joined: Tue May 26, 2015 6:36 pm

Re: Json cgi output breaks when..

Post by caskov »

Oh.. my bad, i should have posted that in the first post, I had to write it up again since a mod nuked the first one by accident so i missed a few details in this one..

I have 3 service groups..
Allstreams - 31 services total - Json with details=true loads without issue, This one shows all servies split between the below two groups..
Stream_Auido 18 services total - fails to load, cutting the json at random points, sometimes mid service, and before long_output is displayed, while services above with the same set of characters are written ok.
Stream_Video 13 services total - Json loads fine.

Altho, since posting this i noticed that i had been a tad to quick to glance over the json delivered with details=false, i didnt notice the servicegroup json included the service status which really makes alot of sense and is all i need for the initial page so the issue is not as big as it looked like at first for me.. :)
caskov
Posts: 3
Joined: Tue May 26, 2015 6:36 pm

Re: Json cgi output breaks when..

Post by caskov »

Also to answer your acutal question, yea there kinda is special characters in the output, but seeing as AllStreams load fine i assumed they didnt matter..

Example of the longoutput:

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=64000,CODECS="mp4a.40.2"
http://URLURLRULURL/i/URLURLRUL@URLURL/ ... &rebase=on
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=64000,CODECS="mp4a.40.2"
http://URLURLRULURL/i/URLURLRUL@URLURL/ ... &rebase=on
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=192000,CODECS="mp4a.40.2"
http://URLURLRULURL/i/URLURLRUL@URLURL/ ... &rebase=on
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=192000,CODECS="mp4a.40.2"
http://URLURLRULURL/URL/URLURLRUL@URLUR ... &rebase=on
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Json cgi output breaks when..

Post by ssax »

Look in your /usr/local/nagios/var/objects.cache for one of the services that are breaking and see if you see anything weird in there, I'm wondering if there are some non ASCII printable characters in there or something. Maybe you could PM me that objects.cache file and let me know which services are breaking so that I can replicate it on my system and dig into it.
Locked