Re: [Nagios-db-devel] nagios-db, nagios v2.0 & MySQL
Status: Beta
Brought to you by:
bench23
From: Dallas H. <da...@ol...> - 2006-04-12 17:37:46
|
Dallas Helquist wrote: > Hello, > > I am looking for the patch to the mysql/inserter.c file that allows it > to compile correctly with nagios 2.0. It seems a patch was released in > the fall of 2005, but was only sent out as an attachment. The > sourceforge lists strip attachments. I can't seem to locate a copy of > it on the sourceforge site, or via a google search. Can someone re-send > it as inline text? Post a URL? Upload it to the sourceforge site? > > See > http://sourceforge.net/mailarchive/forum.php?thread_id=8926718&forum_id=43496 > > <SNIP> Ok, after not having any luck locating a patch for the mysql neb module, I put this together. It is basicly a copy of the postgres patch submitted by Peter Bieringer last year. I _believe_ it works. :) My test box a CentOS 4.2 x86_64. The makefile still needs to be modified accordingly..not very difficult. Patch provided as is. If you have something that works better - let me know! -dallas --- /home/dallas/tmp/nagios-db-0.91/neb/mysql/inserter.c 2005-02-04 17:57:58.000000000 -0700 +++ /usr/src/nagios-db-0.91/neb/mysql/inserter.c 2006-04-12 10:10:16.000000000 -0600 @@ -64,6 +64,7 @@ int buffer(char ***, char*, int); void err_out(char *); void free_buffers(); +void *inserter_module_handle=NULL; extern hostgroup *hostgroup_list; extern servicegroup *servicegroup_list; @@ -115,6 +116,7 @@ { char error[2048]; time_t current_time; + inserter_module_handle=handle; write_to_logs_and_console("initializing nagios-db mysql inserter...",NSLOG_INFO_MESSAGE,TRUE); @@ -135,7 +137,7 @@ write_to_logs_and_console("nagios-db: inserter locked into db",NSLOG_INFO_MESSAGE,TRUE); /* do startup routine after the point when nagios loads its retention file */ - neb_register_callback(NEBCALLBACK_TIMED_EVENT_DATA, 0, loadconfig); + neb_register_callback(NEBCALLBACK_TIMED_EVENT_DATA,inserter_module_handle, 0, loadconfig); } return 0; @@ -340,10 +342,10 @@ write_to_logs_and_console("nagios-db: configuration complete. Registering for status notifications...",NSLO G_INFO_MESSAGE,TRUE); neb_deregister_callback(NEBCALLBACK_TIMED_EVENT_DATA, loadconfig); - neb_register_callback(NEBCALLBACK_HOST_STATUS_DATA, 0, processStatus); - neb_register_callback(NEBCALLBACK_SERVICE_STATUS_DATA, 0, processStatus); - neb_register_callback(NEBCALLBACK_HOST_CHECK_DATA, 0, processCheck); - neb_register_callback(NEBCALLBACK_SERVICE_CHECK_DATA, 0, processCheck); + neb_register_callback(NEBCALLBACK_HOST_STATUS_DATA, inserter_module_handle, 0, processStatus); + neb_register_callback(NEBCALLBACK_SERVICE_STATUS_DATA, inserter_module_handle, 0, processStatus); + neb_register_callback(NEBCALLBACK_HOST_CHECK_DATA, inserter_module_handle, 0, processCheck); + neb_register_callback(NEBCALLBACK_SERVICE_CHECK_DATA, inserter_module_handle, 0, processCheck); return 0; } |