<div>hi,</div>
<div>here is a patch to the current CVS revision of nagios-db for <strong>postgres</strong>. </div>
<div>This patch does:</div>
<div>* correct a bug on startup concerning neb_register_callback command change</div>
<div>* add some logging messages to help debugging</div>
<div>* correct a small typo in handling options (see "offset bugs in option parsing" <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://sourceforge.net/mailarchive/message.php?msg_id=12557459" target="_blank">
http://sourceforge.net/mailarchive/message.php?msg_id=12557459 </a>)</div>
<div>* modified neb initialisation so that 'processStart' is called when Nagios starts and not when we have a NEBCALLBACK_TIMED_EVENT_DATA . The problem was that processStart() was called berfore the nagios configuration was loaded and therefor processStart() did not have configuration data available. 
</div>
<div> </div>
<div>File is available here: <a href="http://www.barbich.net/websvn/wsvn/nagios/nagios/patches/nagios-db/inserter.c.patch?op=file&rev=0&sc=0">http://www.barbich.net/websvn/wsvn/nagios/nagios/patches/nagios-db/inserter.c.patch?op=file&rev=0&sc=0
</a></div>
<div> </div>
<div> </div>
<div>Good luck.</div>
<div>Seb.B</div><span></span><br><br>
<div><span class="gmail_quote">On 11/24/05, <b class="gmail_sendername">Mohr James</b> <<a href="mailto:james.mohr@elaxy.com">james.mohr@elaxy.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>I realized that I was actually compiling it against Nagios2.0b3. So I fixed the Makefile like this:<br>
<br>gcc -g -O2 -Wall -o inserter.o inserter.c -shared -I/opt/INSTALL/nagios/nagios-2.0b5/include/ -I/usr/include/mysql -lmysqlclient -fPIC<br><br>This gave me several messages like this:<br><br>inserter.c: In function `loadconfig':
<br>inserter.c:345: warning: passing arg 3 of `neb_register_callback' makes integer from pointer without a cast<br>inserter.c:345: error: too few arguments to function `neb_register_callback'<br><br>There were only three arguments passed to neb_register_callback, although per 
nebmods.c it should be expecting 4:<br><br>int neb_register_callback(int callback_type, void *mod_handle, int priority, int (*callback_func)(int,void *)){<br><br>So I changed inserter.c accordingly:<br><br>       neb_register_callback(NEBCALLBACK_TIMED_EVENT_DATA,loadconfig, 0, loadconfig);
<br>       neb_register_callback(NEBCALLBACK_HOST_STATUS_DATA,processStatus, 0, processStatus);<br>       neb_register_callback(NEBCALLBACK_SERVICE_STATUS_DATA,processStatus, 0, processStatus);<br>       neb_register_callback(NEBCALLBACK_HOST_CHECK_DATA,processCheck, 0, processCheck);
<br>       neb_register_callback(NEBCALLBACK_SERVICE_CHECK_DATA,processCheck, 0, processCheck);<br><br>In all honesty, I have no idea if this change is correct. It *looks* right, but I am obviously not sure. Any help would be appreaciated.
<br><br>Regards,<br><br>Jim Mohr<br><br>-----Ursprüngliche Nachricht-----<br>Von: <a href="mailto:nagios-users-admin@lists.sourceforge.net">nagios-users-admin@lists.sourceforge.net</a> [mailto:<a href="mailto:nagios-users-admin@lists.sourceforge.net">
nagios-users-admin@lists.sourceforge.net</a>] Im Auftrag von Mohr James<br>Gesendet: Donnerstag, 24. November 2005 20:31<br>An: <a href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><br>
Betreff: [Nagios-users] Nagios-db mysql module not working<br><br>Hi All!<br><br>I have Nagios 2.0b5, nagios-db 0.91 and MySQL 4.1.15, including MySQL-MAX 4.1.15. When Nagios starts I see the module is loaded<br>("nagios-db: inserter locked into db") and the appropriate message when nagios shuts down. However, nothing is getting loaded into the database, and I do not see any error messages in /var/log/messages.
<br><br>I have changed inserted.c to reflect the user/password of the database<br>(nagios/nagios) and I can log inusing the mysql command and insert data directly into the tables. I have also tried changing the values (i.e
.<br>nagios2/nagios) in the nebmodule_init function and it reports the error<br>"nagios-db: inserter failed to connect to db". This convinces be that at least I am connecting to the database and the username/password are correct.
<br><br>The nagios.cfg has this:<br><br>event_broker_options=-1<br>broker_module=/opt/INSTALL/nagios-db-0.91/neb/mysql/inserter.o<br><br>And the path is correct.<br><br>Near the top of the loadconfig function I added this:
<br><br>write_to_logs_and_console("Inside of<br>loadconfig",NSLOG_INFO_MESSAGE,TRUE);<br><br>As well as in a couple of other places.<br><br>My assumption is that it should write an entry to /var/log/messages when this function is called. Perhaps the function is being called, but this line is not writing to where I expect. It seems that other than the init/deinit functions, nothing else is getting called.
<br><br>I loaded another NEB module that has this:<br><br>snprintf(temp_buffer,sizeof(temp_buffer)-1,"EVENT: %d MESSAGE:<br>%s",event_type,tmp_service->plugin_output);<br>write_to_all_logs(temp_buffer,NSLOG_INFO_MESSAGE);
<br><br>These messages are getting writting to the /var/log/messages.<br><br>I am at a loss as to where to look next. Any help is greatly appreaciated.<br><br>Regards,<br><br>Jim Mohr<br><br>-------------------------------------------------------
<br>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!
<br><a href="http://ads.osdn.com/?ad_idv37&alloc_id865&op=ick">http://ads.osdn.com/?ad_idv37&alloc_id865&op=ick</a><br>_______________________________________________<br>Nagios-users mailing list<br><a href="mailto:Nagios-users@lists.sourceforge.net">
Nagios-users@lists.sourceforge.net</a><br><a href="https://lists.sourceforge.net/lists/listinfo/nagios-users">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
<br>::: Messages without supporting info will risk being sent to /dev/null<br><br><br>-------------------------------------------------------<br>This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
<br>for problems?  Stop!  Download the new AJAX search engine that makes<br>searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!<br><a href="http://ads.osdn.com/?ad_idv37&alloc_id865&opclick">http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
</a><br>_______________________________________________<br>Nagios-users mailing list<br><a href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><br><a href="https://lists.sourceforge.net/lists/listinfo/nagios-users">
https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.<br>::: Messages without supporting info will risk being sent to /dev/null
<br></blockquote></div><br>