[collectd] How to compile my own plugin?

Florian Forster octo at verplant.org
Sat Dec 20 12:02:17 CET 2008


Hi Marco,

On Tue, Dec 09, 2008 at 09:56:38PM +0100, Marco Chiappero wrote:
> The *real* problem it's, I suppose, the Macro (AC_PLUGIN).
> First of all I added the macro in "configure.in", then I modified the 
> "src/Makefile.am" file (is that right? I think you should specify  that 
> it's the one in the src dir),

yes, that's the one. Possibly I've worked with Makefiles for too lone,
because the fact that each Makefile build the targets of the directory
it is in was self-evident to me ;) I've updated the web page describing
the build system to be more specific.

> finally I ran make. It didn't work. So I decided to modify the
> "configure" script

Not good: Modifying automatically generated code is usually a nightmare
(anyone ever took a look at the C code generated by lex/yacc? ;) and,
once the file gets re-generated, repetitive ;)

> I've never used git so I have no idea how to get the build.sh script),

Basically it's:
  git clone git://git.verplant.org/collectd.git

For more information see [1].

> compiled but still not creating my plugin. After that I had a look at
> "config.h" and no HAVE_PLUGIN_UPTIME was defined. I suppose I did
> everything right but the Macro was not "translated". Any ideas?

You definitely need to re-generate those build files - just editing the
generated files won't get you anywhere in any reasonable amount of time.
If you don't want to or can't use the Git version, you can manually
re-generate the required files either by running
  $ autoreconf
or by using the more thorough but also more complex chain:
  $ autoheader \
    && aclocal \
    && libtoolize --ltdl --copy --force \
    && automake --add-missing --copy \
    && autoconf

See [2] for more details.

[ip6tables plugin]
> Maybe creating <ipv4> and <ipv6> subsections (but I don't know if the 
> core can deal with them) or specifying at every single rule whether it 
> is referred to ipv4 or ipv6 [...] 
> I can't say which one is better, from the performance point of view
> probably just a single plugin is best. But certainly different plugins
> it's the easy way, while if some modification are required you have to
> do it twice.

Since the iptables plugin has only one statement (`Chain'), adding
something like `Chain6' seems easy enough. I fear that next year someone
will come along and need `ebtables'.. So I think it's best to put all
the netlink stuff in a separate module and create two plugins. That's
much cleaner in the long run, imho.

[uptime plugin]
> But I can comprehend your doubts, and I wouldn't expect to be a
> successful plugin. From my standpoint the plugin doesn't hurt, it's
> ready, it's small and the related rrd archive it's even smaller, why
> not to use it? :)

Okay, go ahead and send it in, I'll take a look :)

Regards,
-octo

[1] <http://www.kernel.org/pub/software/scm/git/docs/everyday.html>
[2] <http://www.gnu.org/software/autoconf/manual/html_node/autoreconf-Invocation.html#autoreconf-Invocation>
-- 
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/20081220/a1a2aabe/attachment.pgp 


More information about the collectd mailing list