Page 1 of 1

[Nagios-devel] Event Broker help..

Posted: Wed Jan 18, 2006 3:24 pm
by Guest
Hello again...

I need some guidance on using the global (from the module perspective at
least) variables. In short, I'm defining these in the module

static SQLHENV *Senv;
static SQLHDBC *Sdbc;
static SQLHSTMT *Sstmt0;
static SQLHSTMT *Sstmt1;


Now, I'm able to use these when nebmodule_init directly calls my DBinit
and DBtest functions as listed below... (the DBtest issues sql
insert/updates on a dummy table)...=20



int nebmodule_init( ... ) {
.
.

read_params(dbentry);
/* Open DB connection and allocate handles*/
DBinit(dbentry);
snprintf(temp_buffer,sizeof(temp_buffer)-1,"nagios-EFM: Created
DB conne
ction");
temp_buffer[sizeof(temp_buffer)-1]=3D'\x0';
write_to_all_logs(temp_buffer,NSLOG_INFO_MESSAGE);

DBtest();
.
.
.

But, when I try to use the global variables inside functions registered
via neb_register_callback, they seem to get lost... for example, I
first register my function:
neb_register_callback(NEBCALLBACK_TIMED_EVENT_DATA,nagiosdb_module_handl
e,0,loadConfig);

and the loadConfig function attempts to use the same global variables
(SstmtX) which worked when DBinit/DBtest were called..

.
.
ret=3DSQLPrepare(*Sstmt0, initHost, SQL_NTS);
.
.
And this fails miserably.

. Has anyone been able to share a global variables, that once
defined/acted on by nebmodule_init, it is accessible by all registered
functions/callbacks? Is this possible anymore? My reference has been the
nagios-db code, but that seems quite outdated for the current
2.0rc2.....

TIA,

Eloy F. 'Frank' Macha
ERP Technology Services
AtosOrigin, Inc
Office: +1 817 264 8465
Cell: +1 972 814 4979
Fax: +1 817 264 8209
email: [email protected]
www.atosorigin.com






This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]