Nagios-db mysql module not working UPDATE

Sébastien Barbereau barbereau at gmail.com
Thu Nov 24 23:26:52 CET 2005


hi,
here is a patch to the current CVS revision of nagios-db for *postgres*.
This patch does:
* correct a bug on startup concerning neb_register_callback command change
* add some logging messages to help debugging
* correct a small typo in handling options (see "offset bugs in option
parsing" http://sourceforge.net/mailarchive/message.php?msg_id=12557459 )
* 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.

File is available here:
http://www.barbich.net/websvn/wsvn/nagios/nagios/patches/nagios-db/inserter.c.patch?op=file&rev=0&sc=0


Good luck.
Seb.B


On 11/24/05, Mohr James <james.mohr at elaxy.com> wrote:
>
>
> I realized that I was actually compiling it against Nagios2.0b3. So I
> fixed the Makefile like this:
>
> gcc -g -O2 -Wall -o inserter.o inserter.c -shared
> -I/opt/INSTALL/nagios/nagios-2.0b5/include/ -I/usr/include/mysql
> -lmysqlclient -fPIC
>
> This gave me several messages like this:
>
> inserter.c: In function `loadconfig':
> inserter.c:345: warning: passing arg 3 of `neb_register_callback' makes
> integer from pointer without a cast
> inserter.c:345: error: too few arguments to function
> `neb_register_callback'
>
> There were only three arguments passed to neb_register_callback, although
> per nebmods.c it should be expecting 4:
>
> int neb_register_callback(int callback_type, void *mod_handle, int
> priority, int (*callback_func)(int,void *)){
>
> So I changed inserter.c accordingly:
>
>        neb_register_callback(NEBCALLBACK_TIMED_EVENT_DATA,loadconfig, 0,
> loadconfig);
>        neb_register_callback(NEBCALLBACK_HOST_STATUS_DATA,processStatus,
> 0, processStatus);
>
> neb_register_callback(NEBCALLBACK_SERVICE_STATUS_DATA,processStatus, 0,
> processStatus);
>        neb_register_callback(NEBCALLBACK_HOST_CHECK_DATA,processCheck, 0,
> processCheck);
>        neb_register_callback(NEBCALLBACK_SERVICE_CHECK_DATA,processCheck,
> 0, processCheck);
>
> 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.
>
> Regards,
>
> Jim Mohr
>
> -----Ursprüngliche Nachricht-----
> Von: nagios-users-admin at lists.sourceforge.net [mailto:
> nagios-users-admin at lists.sourceforge.net] Im Auftrag von Mohr James
> Gesendet: Donnerstag, 24. November 2005 20:31
> An: Nagios-users at lists.sourceforge.net
> Betreff: [Nagios-users] Nagios-db mysql module not working
>
> Hi All!
>
> 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
> ("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.
>
> I have changed inserted.c to reflect the user/password of the database
> (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.
> nagios2/nagios) in the nebmodule_init function and it reports the error
> "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.
>
> The nagios.cfg has this:
>
> event_broker_options=-1
> broker_module=/opt/INSTALL/nagios-db-0.91/neb/mysql/inserter.o
>
> And the path is correct.
>
> Near the top of the loadconfig function I added this:
>
> write_to_logs_and_console("Inside of
> loadconfig",NSLOG_INFO_MESSAGE,TRUE);
>
> As well as in a couple of other places.
>
> 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.
>
> I loaded another NEB module that has this:
>
> snprintf(temp_buffer,sizeof(temp_buffer)-1,"EVENT: %d MESSAGE:
> %s",event_type,tmp_service->plugin_output);
> write_to_all_logs(temp_buffer,NSLOG_INFO_MESSAGE);
>
> These messages are getting writting to the /var/log/messages.
>
> I am at a loss as to where to look next. Any help is greatly appreaciated.
>
> Regards,
>
> Jim Mohr
>
> -------------------------------------------------------
> 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://ads.osdn.com/?ad_idv37&alloc_id865&op=ick
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when
> reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>
>
> -------------------------------------------------------
> 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://ads.osdn.com/?ad_idv37&alloc_id865&opclick
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when
> reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20051124/6b63518b/attachment.html>


More information about the Users mailing list