[collectd] [PATCH] mysql plugin: add support for multiple databases

Florian Forster octo at verplant.org
Tue Mar 17 10:05:32 CET 2009


Hi Doug,

On Mon, Mar 16, 2009 at 06:29:23PM -0400, Doug MacEachern wrote:
> Similar to the recent apache plugin thread, this patch adds config
> support to monitor multiple databases from the same collectd instance.
> Most of the logic was borrowed from the dbi plugin.

looks great, thank you :) I've applied your patch to the master branch.

> To support legacy mode, the plugin_instance is only set if there are >
> 1 database configured.. should probably have an option to always set
> the plugin_instance?

I think we can safe ourselves some trouble if we just mark the legacy
database as such, i. e. introduce a field such as `int legacy;' which we
will set to non-zero if this database has been configured with the
legacy code.

If this flag is set,
 - always keep plugin-instance unset,
 - always use hostname_g.
Otherwise, if the flag is unset,
 - use the string argument to the <Database> block as plugin instance,
 - set the hostname according to the configuration instead of using
   hostname_g. What we do in other plugins is something like this:
     if (host == "localhost")
       host = hostname_g;
   This may make sense here, too.

That should be pretty straight forward I hope. What do you think?

This whole ``database as in the daemon you connect to'' vs. ``database
as in the thing that holds tables together'' is confusing as hell. Maybe
we should rename the blocks to something more distinct, such as `DBMS'
or `Connection'?

What about adding a ``Database'' option to the (possibly renamed)
<Database> blocks? This way plugin instance and database name could be
separate. This would make sense imho, because I think this `Database'
option is often unset.

One thing that has bugged me for a long time are the `mysql_qcache' and
`mysql_threads' types. What do you think about taking this opportunity
to straighten this up? I. e. use these types only when in legacy mode
and use new, better, more polished types when in non-legacy mode?

I'm not sure about this, to be honest, because it adds some magic and I
dislike magic in software ;) On the other hand, this *is* an opportunity
to fix some really ugly legacy types..

Regards,
-octo
-- 
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20090317/cafe54b8/attachment.pgp 


More information about the collectd mailing list