Andreas Ericsson wrote:
K-L Reinhard wrote:
Mark, thanks a lot for this explanation and the hints. I think I'll have a
look at the event broker thing.
C coding skills are required. For a nudge to get you started, have a look
at modules/helloworld.c in the nagios source distribution.
If you don't do it, I'll use this example as the module-writing exercise
for my Netways presentation. The first to complete it wins a weissbier in
the hotel bar :-)
Here's the completed thing. I rearranged things a tiny bit, so I had to
write it myself. How to compile is written in the top comment. You pass
it the script you want it to run as argument when loading it in the
nagios.cfg file. Make sure the script runs quickly, because Nagios
will be stalled while it's executing.
Note that on linux, you can achieve the same thing in a better way
using incrond. That won't work for other systems though, as inotify(7)
is a linux specific api.
--
Andreas Ericsson [EMAIL PROTECTED]
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
/*
* Author: Andreas Ericsson <[EMAIL PROTECTED]>
* Copyleft: GPLv2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt)
*
* To compile:
* gcc -o nebsor.o -fPIC -c -DDSO="nebsor.so" -I. -O1 -pipe -Wall nebsor.c
* gcc -shared -nostartfiles -fPIC nebsor.o -o nebsor.so
*/
#include <nagios/broker.h>
#include <nagios/nebcallbacks.h>
#include <nagios/nebstructs.h>
NEB_API_VERSION(CURRENT_NEB_API_VERSION);
static nebmodule *neb_handle;
int nebmodule_init(int flags, char *arg, nebmodule *mod)
{
neb_handle = mod;
return 0;
}
int nebmodule_deinit(int flags, int reason)
{
return neb_deregister_module_callbacks(neb_handle);
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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