How to incorporate module in broker_module?
Atoosah
atoosaah at gmail.com
Thu Apr 23 21:23:41 CEST 2009
- I'm new to developing in Nagios and am having trouble adding the
helloworld module that comes in the nagios-3.1.0/module/ directory. When
using the suggested command of "gcc -shared -o helloworld.o helloworld.c" or
the given module/Makefile or via nagios's overall "make all" (when removing
the -undefined supress gcc option) I receive the following error:
--------------------------------------------
ERROR BELOW:
--------------------------------------------
[module]$ gcc -shared -o helloworld.o helloworld.c
Undefined symbols:
"_main", referenced from:
start in crt1.10.5.o
"_schedule_new_event", referenced from:
_nebmodule_init in cctSjeOe.o
"_neb_deregister_callback", referenced from:
_nebmodule_deinit in cctSjeOe.o
"_write_to_all_logs", referenced from:
_nebmodule_init in cctSjeOe.o
_nebmodule_init in cctSjeOe.o
_nebmodule_deinit in cctSjeOe.o
_helloworld_reminder_message in cctSjeOe.o
_helloworld_handle_data in cctSjeOe.o
"_neb_set_module_info", referenced from:
_nebmodule_init in cctSjeOe.o
_nebmodule_init in cctSjeOe.o
_nebmodule_init in cctSjeOe.o
_nebmodule_init in cctSjeOe.o
_nebmodule_init in cctSjeOe.o
_nebmodule_init in cctSjeOe.o
"_neb_register_callback", referenced from:
_nebmodule_init in cctSjeOe.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
[module]$
--------------------------------------------
- The neb_set_module_info function does exist, shown below:
[nagios-3.1.0]$ grep -Hnr "neb_set_module_info" *cd ..
Binary file base/nagios matches
Binary file base/nagios.dSYM/Contents/Resources/DWARF/nagios matches
base/nebmods.c:391:int neb_set_module_info(void *handle, int type, char
*data){
Binary file base/nebmods.o matches
include/nebmodules.h:96:int neb_set_module_info(void *,int,char *);
module/helloworld.c:61:
neb_set_module_info(helloworld_module_handle,NEBMODULE_MODINFO_TITLE,"helloworld");
[nagios-3.1.0]$
--------------------------------------------
Makefile BELOW
--------------------------------------------
# Makefile for NEB examples
#
# Last Modified: 12-14-2007
# Source code directories
SRC_INCLUDE=../include
CC=gcc
MOD_CFLAGS= -fno-common
CFLAGS=-g -O2 -I/sw/include/ -DHAVE_CONFIG_H
#MOD_LDFLAGS=-bundle -flat_namespace -undefined suppress
MOD_LDFLAGS=-bundle -flat_namespace
LDFLAGS= -L/sw/lib/
LIBS=
prefix=/usr/local/nagios
exec_prefix=${prefix}
BINDIR=${exec_prefix}/bin
INSTALL=/usr/bin/install -c
INSTALL_OPTS=-o nagios -g nagios
COMMAND_OPTS=-o nagios -g nagiocmd
STRIP=/usr/bin/strip
CP=@CP@
all: helloworld.o
helloworld.o: helloworld.c
$(CC) $(MOD_CFLAGS) $(CFLAGS) -o helloworld.o helloworld.c
$(MOD_LDFLAGS) $(LDFLAGS) $(LIBS)
--------------------------------------------
- Finally, I copy helloworld.o from where nagios runs and enable the
even_broker in nagios.cfg"
broker_module=/usr/local/nagios/bin/helloworld.o
Why would gcc not find/compile the needed files? I'd appreciate any pointers
you would give in how to successfully compile the sample module.
thank you,
atoosaah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20090423/02d7bd7e/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel
More information about the Developers
mailing list