AW: New event broker module for DB storage...

Gerhard Lausser Gerhard.Lausser at consol.de
Mon Jan 9 18:33:32 CET 2006


Hi Ethan,

i installed the new module and found the following problem.
It should only occur if you use a mysql5.x version. 
The table ndo_conninfo contains a column called "connection" which is a
reserved word in mysql5.x, causing the insert statement in db.c/line 296 to
fail.
I made a small patch which replaces "connection" with "connect_sink" at two
places to make it run for me. Maybe it would be more clean, if also the
connection member of the ndo2db_idi structure would be renamed. Maybe even
the NDO_API_CONNECTION. But i didn't want to mess around in your code.

Greetings from munich,
Gerhard

diff -Naur ndoutils-12272005/db/ndo-mysql.sql
ndoutils-12272005-mysql5/db/ndo-mysql.sql
--- ndoutils-12272005/db/ndo-mysql.sql	2005-12-27 20:17:19.000000000 +0100
+++ ndoutils-12272005-mysql5/db/ndo-mysql.sql	2006-01-09
18:16:05.990545150 +0100
@@ -145,7 +145,7 @@
   `agent_name` varchar(32) NOT NULL default '',
   `agent_version` varchar(8) NOT NULL default '',
   `disposition` varchar(16) NOT NULL default '',
-  `connection` varchar(16) NOT NULL default '',
+  `connect_sink` varchar(16) NOT NULL default '',
   `connect_type` varchar(16) NOT NULL default '',
   `connect_time` datetime NOT NULL default '0000-00-00 00:00:00',
   `disconnect_time` datetime NOT NULL default '0000-00-00 00:00:00',
diff -Naur ndoutils-12272005/src/db.c ndoutils-12272005-mysql5/src/db.c
--- ndoutils-12272005/src/db.c	2005-12-27 20:17:19.000000000 +0100
+++ ndoutils-12272005-mysql5/src/db.c	2006-01-09 18:18:02.028791972 +0100
@@ -293,7 +293,7 @@
 	ts=ndo2db_db_timet_to_sql(idi,idi->data_start_time);
 
 	/* record initial connection information */
-	if(asprintf(&buf,"INSERT INTO %s SET instance_id='%lu',
connect_time=NOW(), last_checkin_time=NOW(), bytes_processed='0',
lines_processed='0', entries_processed='0', agent_name='%s',
agent_version='%s', disposition='%s', connection='%s', connect_type='%s',
data_start_time=%s"
+	if(asprintf(&buf,"INSERT INTO %s SET instance_id='%lu',
connect_time=NOW(), last_checkin_time=NOW(), bytes_processed='0',
lines_processed='0', entries_processed='0', agent_name='%s',
agent_version='%s', disposition='%s', connect_sink='%s', connect_type='%s',
data_start_time=%s"
 		    ,ndo2db_db_tablenames[NDO2DB_DBTABLE_CONNINFO]
 		    ,idi->instance_id
 		    ,idi->agent_name


Also available at
http://people.consol.de/~lausser/nagios/ndoutils-12272005-mysql5.patch
Apply it with:
tar zxvf ndoutils-12272005.tar.gz
patch -d ndoutils-12272005 -p1 < ndoutils-12272005-mysql5.patch



-------------------------------------------------------
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_id=7637&alloc_id=16865&op=click




More information about the Developers mailing list