Re: [Nagios-users] A couple of Nagios NEB plugin API questions

2012-08-10 Thread Andreas Ericsson
On 08/09/2012 02:39 PM, Razvan Cojocaru wrote:
 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.
 
 That was entirely uncalled for. Some of us prefer to ask similarly
 minded peers where we feel it's not unreasonable to do so, rather than
 go with the the code is the documentation attitude (which I am not
 putting down, to each his (or her) own).
 
 I thought it obvious both that I've done my homework, and that I am
 quite able to stand on my own two feet. Apparently I wasn't as clear as
 I should have been.
 

I didn't mean to be rude. Since you do seem like a clever guy who has
indeed done his homework I figured that question was more of a complaint
along the lines of this should probably be documented too.

 
 Thank you for answering,
 

You're welcome.

-- 
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


[Nagios-users] A couple of Nagios NEB plugin API questions

2012-08-09 Thread Razvan Cojocaru
Hello,

I've read the NEB Module API document [1], and the nebstructs.h
header, but I'd like more details about the members of
nebstruct_notification_struct. The document shows the struct definition
with no comments, and no example, and there are no comments for the
individual members in the nebstructs.h header either.

Also, this article [2] suggests that you can pass configuration data to
your NEB module with this syntax:

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
a dedicated callback? By accessing some global data structure within the
Nagios core process that loads my module?

I thought I'd find this information in the PDF file, but Appendix B:
Catalog of Global Nagios Data Structures only says TBA.


[1]
http://nagios.sourceforge.net/download/contrib/documentation/misc/NEB%202x%20Module%20API.pdf

[2]
http://searchenterpriselinux.techtarget.com/tip/Managing-events-with-Nagios-Event-Broker


Thanks,
-- 
Razvan Cojocaru

Linux Development Core Romania

11 Internet Development S.R.L. - Bucharest/Romania
Web: www.1und1.de


--
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


Re: [Nagios-users] A couple of Nagios NEB plugin API questions

2012-08-09 Thread Andreas Ericsson
On 08/09/2012 08:39 AM, Razvan Cojocaru wrote:
 Hello,
 
 I've read the NEB Module API document [1], and the nebstructs.h
 header, but I'd like more details about the members of
 nebstruct_notification_struct. The document shows the struct definition
 with no comments, and no example, and there are no comments for the
 individual members in the nebstructs.h header either.
 

Well, the individual members are fairly self-explanatory, don't you
think? Ethan's big on mnemonic names, and for a very good reason.

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.

 Also, this article [2] suggests that you can pass configuration data to
 your NEB module with this syntax:
 
 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
 a dedicated callback? By accessing some global data structure within the
 Nagios core process that loads my module?
 

It's the char * argument to your module's nebmodule_init() function.

-- 
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


Re: [Nagios-users] A couple of Nagios NEB plugin API questions

2012-08-09 Thread Razvan Cojocaru
 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.

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

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

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.


Thanks,
-- 
Razvan Cojocaru

Linux Development Core Romania

11 Internet Development S.R.L. - Bucharest/Romania
Web: www.1und1.de


--
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


Re: [Nagios-users] A couple of Nagios NEB plugin API questions

2012-08-09 Thread Andreas Ericsson
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


Re: [Nagios-users] A couple of Nagios NEB plugin API questions

2012-08-09 Thread Razvan Cojocaru
 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.

That was entirely uncalled for. Some of us prefer to ask similarly
minded peers where we feel it's not unreasonable to do so, rather than
go with the the code is the documentation attitude (which I am not
putting down, to each his (or her) own).

I thought it obvious both that I've done my homework, and that I am
quite able to stand on my own two feet. Apparently I wasn't as clear as
I should have been.


Thank you for answering,
-- 
Razvan Cojocaru

Linux Development Core Romania

11 Internet Development S.R.L. - Bucharest/Romania
Web: www.1und1.de


--
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