Nagios 4: Registering object relationships in CGIs

Andreas Ericsson ae at op5.se
Fri Jan 18 12:41:55 CET 2013


On 01/18/2013 12:29 PM, Ton Voon wrote:
> Hi Andreas,
> 
> On 16 Jan 2013, at 17:37, Andreas Ericsson wrote:
> 
>> Well, the story goes like this:
>> We would *actually* want to use the recombobulate_*groups() functions,
>> but those rely on find_*(), add_member_to_group() and a whole bunch of
>> other functions which are inside #ifndef NSCGI (or #ifdef NSCORE).
>>
>> Those functions bring in yet other functions and some of *those* live
>> in other files. There are no functions anywhere that reside in the
>> base/ directory which have to be linked to the cgi's no matter how far
>> down the rabbithole you go, but it's a bit of a mess, really, and
>> with the recent improbable-but-possible coredump issue in Nagios core
>> I was forced to take a short hiatus from cgi issues and jump on that
>> one instead.
>>
>> Anyways; It's unlikely manageable to fix it the proper way. If you
>> beat me to a hack that just iterates over the string elements inside
>> register_*group(), I think I'll just take that patch instead and put
>> a big fat "FIXME this is fugly and should use <solutionX> instead".
> 
> I think I've fixed this "properly", as properly as possible. Can you review?
> 

Done(ish). I still have to apply and see how it goes. It looks as though
you had the time and energy to do what I attempted but got sidetracked
doing, so all in all it's a big thumbs up.

I'll make an extra patch on top of this to give the cgi's a fake version
of the "test_scheduling" variable in addition to the current ones, and
also make them macros so even really dumb preprocessors can remove the
code entirely for us.

> Most of the changes are just #ifdefs moved to appropriate places. It seems that the parsing of objects.cache was done, just the expansion was not. I'm assuming that host/service dependency information is not required in the CGIs.
> 

It isn't, except for the "view config" page, but I'll leave that as a
headache for another day.

> I've also included a test update which checks the CGI are returning the object information correctly. svn has marked t/610cgistatus.t as an application/x-troff so was not showing the diff correctly. I've included as a separate file. Can this be fixed in svn please.
> 

Another reason to hate svn then. Blegh.

I have no idea how one sets svnprops (or whatever one does), so I
can't fix that myself, but sending the entire file is fine.

Thanks.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812




More information about the Developers mailing list