[collectd] Documentation to write Plugins

Marc Fournier marc.fournier at camptocamp.com
Thu Sep 15 08:02:37 CEST 2016


On Tue, Sep 13, 2016 at 11:25:35AM +0200, Thijs Cramer wrote:
> Nice! That helps a lot!
> Is there any guide on how to compile/test properly? I couldn't find
> any guide on how the .c code is included.

Something along these lines *should* work:

gcc -DHAVE_CONFIG_H -Wall -Werror -g -O2 -shared -fPIC -Isrc/ -Isrc/daemon/ -ldl -o myplugin.so contrib/examples/myplugin.c

Although it seems there are a couple of issues with this myplugin.c example
(include paths are incorrect to start with).


> Can i presume that the make script will automatically compile all .c
> files in the /src directory and include them in the CollectD builtin
> plugins?
> (as in, there is no hard linking of plugin source code files)

For the "automatic" part to happen, the plugin needs to get declared in
configure.ac and src/Makefile.am, then the build.sh script ran. This will
generate the configure script, which itself will generate the Makefiles.

Take a look at a recent pull-request adding a new plugin on github.
https://github.com/collectd/collectd/pull/1805/files is a good example.

HTH,
Marc




More information about the collectd mailing list