On 08/09/2012 12:16 PM, Razvan Cojocaru wrote:
>> Well, the individual members are fairly self-explanatory, don't you
>> think? Ethan's big on mnemonic names, and for a very good reason.
> 
> Yes, you can glean what they're for from their names, but that's not
> what I was asking. It's one thing to know that a field called "flags"
> should probably be set to some OR-ed or AND-ed bits, and quite another
> to know what those bits should be or what behaviour they will trigger,
> for example.
> 

The flags are variations for the callback. All nebstructs have them.

> And you can't quite glean even that much about what a void *object_ptr
> does or means.
> 

Yes you can, if you know just a tiny bit about Nagios. It's a pointer
to either a host or a service. Which it is depends on the type of
callback we're issuing.

> I'll figure out what the docs don't say by reading the code.
> 
> 
>> You might want to check out some module and use as example though.
>> mod_gearman provides a good resource, as does NDOUtils and Merlin.
>> Livestatus is pretty nifty, but unless you're mentally equipped to
>> follow the tons and tons of C++ boilerplate I advise against using
>> it as anything but an excellent backend to your data.
>>
>> At http://git.op5.org/git/?p=nagios/merlin.git;a=summary you'll
>> find the merlin source-code. If you're not git-literate you might
>> want to download a snapshot. "module.c" and "hooks.c" has most of
>> the code that handles nebstruct type objects.
> 
> I'm already going that route, and yes, I am git-literate. Thanks for the
> suggestions! I didn't get to Merlin yet.
> 
> 
>>> broker_module=/usr/local/nagios/bin/testmodule.o
>>> config_file=/usr/local/nagios/etc/testmodule.cfg
>>>
>>> How does one access that configuration data from within the plugin? Via
>>
>> It's the "char *" argument to your module's nebmodule_init() function.
> 
> Thanks! But the "char *" argument of nebmodule_init() passes the
> "command line arguments" for the module, i.e.:
> 
> broker_module=/usr/local/nagios/bin/testmodule.o arguments
> 

Yes. I thought your line was just wrapped because it was too long.

> However, I was asking about accessing data written in a regular Nagios
> .cfg file. The article I've quoted clearly implies that this can be
> done; it's possible that they're wrong, but if they're not, I'd like to
> know "extern whattype* what" gives me access to the parsed Nagios
> configuration data.
> 

Good question. I just access the global variables after Nagios has
parsed them. In Merlin, the module command argument points to a
configuration file, which Merlin has its own parser for.

You can't add random variables to the Nagios configuration file
though, since that'll make Nagios barf rather than passing it on
to modules.

-- 
Andreas Ericsson                   andreas.erics...@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.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Reply via email to