[Nagios-devel] access object data inside of nebmodule_init()
Posted: Fri Jan 11, 2008 3:07 pm
I'm working on a NEB module and would like to access host and service
objects during the module init. This is an attempt to build a list of
all hosts and associated services from the start, rather than waiting
for the EB to send object information as things happen.
To start with I'm using the filesystem status interface example in David
Josephsen's book. I want to create all of the host directories and
service files first, then update them with status when it becomes
available.
I've tried to use;
extern host *host_list;
extern service *service_list;
extern char *config_file;
read_all_object_data(config_file);
Which will allow me to use;
for (temp_host=3Dhost_list ; temp_host!=3DNULL ; =
temp_host=3Dtemp_host->next)
{
for (temp_service=3Dservice_list ; temp_service!=3DNULL ;
temp_service=3Dtemp_service->next) {
}
}
However once I do this it apparently messes up the data already read in
by Nagios on start up so I get errors like;
[1199996860] Done.
[1199996860] Event broker module '/opt/nagios/bin/statechange_neb.o'
initialized successfully.
[1199996860] Error: Timeperiod '24x7' has already been defined
[1199996860] Error: Could not register timeperiod (config file
'/opt/nagios/etc/timeperiods.cfg'
, starting on line 7)
[1199996860] Bailing out due to one or more errors encountered in the
configuration files. Run
Nagios from the command line with the -v option to verify your config
before restarting. (PID=3D32
539)
[1199996860] Unloading STATECHANGE Module...
[1199996860] Event broker module '/opt/nagios/bin/statechange_neb.o'
deinitialized successfully.
How can I get to the host_list and service_list structs without messing
with the variables?
Thanks,
Don
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]