Event Broker help..
Macha, Frank
frank.macha at atosorigin.com
Thu Jan 19 00:24:16 CET 2006
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)...
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]='\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=SQLPrepare(*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: frank.macha at atosorigin.com
www.atosorigin.com
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
More information about the Developers
mailing list