[collectd] TokyoTyrant plugin (was: Changes suggested by Sebastian Harl.)

Paul Sadauskas psadauskas at gmail.com
Mon Jul 6 21:53:02 CEST 2009

Thanks for taking a look my plugin. I'd be happy to work on these
TODOs, but I had some further questions.

On Mon, Jul 6, 2009 at 9:08 AM, Florian Forster<octo at verplant.org> wrote:

> I'd have the following todos before that, though:
>  * The `Port' configuration option should expect a string. This may be
>   weird at first sight, but please keep in mind that ports may be
>   specified by their symbolic name given in /etc/services as well.
>   As far as I see the TokyoTyrant-API expects an integer. So I guess
>   the best we can do is probably to call `getservbyname(3)'. The string
>   version of the port should simply be strdup'ed.

I pretty much just copied what was in the mysql plugin for my hostname
and port configuration options. I grepped through the source for any
instance of getservbyname that I could use as an example, but found
none. From my understanding of the manpage, getservbyname is just an
interface on top of /etc/services. TokyoTyrant doesn't have an entry
in there, on my system at least, so I'm not sure how useful this
functionality would be. I see a few other plugins using strings for
ports, but it looks like they're using getaddrinfo. If anyone wants to
help me do it with getservbyname, I'd greatly appreciate it. For now,
I'll just atoi the string before connecting.

>  * The database is opened and closed at each iteration, which appears to
>   be more overhead than necessary. Would it be possible to keep the
>   connection open for as long as possible?

This seems like a good idea, but I'm not really sure how much it
saves. I was planning on implementing it as some point, but I'll have
to spend some time figuring out pthreads.

>  * Since the plugin provides configuration options, it must be
>   documented in the collectd.conf(5) manual page.

I've added some documentation.

You can see my changes in my github fork, and I've merged in the
ps/tokyotyrant branch as well.


Thanks for the pointers,

More information about the collectd mailing list