[collectd] [PATCH] mysql plugin: add support for multipledatabases

Doug MacEachern Doug.MacEachern at hyperic.com
Tue Mar 17 21:51:53 CET 2009

Hi Florian,
> Actually, that ``wait for a while'' code is also implemented in the
> code that calls the `read' functions and is triggered automatically
> when a `read' function returns non-zero. So the currently ``best'' way
> would be to register one read-function for each database, using the
> `plugin_register_complex_read' function. When I find some spare time,
> I'll do this, but I don't mind if someone beats me to it.. ;)

Ah very nice, `complex_read' makes things much simpler ;)
Other minor changes in the patch..
On an older machine w/ gcc 3.4.6: "mysql.c:130: warning: 'status' might
be used uninitialized in this function", cured with:
-	int status;
+	int status = 0;

db->database was NULL, which mysql_real_connect doesn't seem to mind?
+		db->database = strdup (db->instance);

Also added to free:
+	sfree (db->instance);
+	sfree (db->database);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mysql-plugin-use-plugin_register_complex_read.patch
Type: application/octet-stream
Size: 5387 bytes
Desc: 0001-mysql-plugin-use-plugin_register_complex_read.patch
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20090317/ea634b7e/attachment.obj 

More information about the collectd mailing list