Martin Martin - 11 months ago 80
Perl Question

Collectd - Perl/Python plugin - registration functions not working

I would like to ask about Collectd's plugins Perl and Python and their registration functions.

I tried to code plugin in Perl (and also in Python), set up read and write functions and after that register them into Collectd (plugin_register functions). In all cases it wasnt working. Everytime, the logs show:

Found a configuration for the "my_plugin" plugin, but the plugin
isn't loaded or didn't register a configuration callback.

I load my plugin in perl.conf.

Below I attach example of plugin which is directly from Collectd.perl documentation. This plugin, as well as my plugin, has the same result.

package Collectd::Plugins::FooBar;
use strict;
use warnings;
use Collectd qw( :all );

sub foobar_read
my $vl = { plugin => 'foobar', type => 'gauge' };
$vl->{'values'} = [ rand(42) ];
plugin_dispatch_values ($vl);
return 1;
sub foobar_write
my ($type, $ds, $vl) = @_;
for (my $i = 0; $i < scalar (@$ds); ++$i) {
print "$vl->{'plugin'} ($vl->{'type'}): $vl->{'values'}->[$i]\n";
return 1;

sub foobar_match
my ($ds, $vl, $meta, $user_data) = @_;
if (matches($ds, $vl)) {
} else {

plugin_register (TYPE_READ, "foobar", "foobar_read");
plugin_register (TYPE_WRITE, "foobar", "foobar_write");
fc_register (FC_MATCH, "foobar", "foobar_match");

Answer Source

Post your configuration if you can.

The documentation says that the LoadPlugin configuration goes in the collectd.conf file (not that that seems to matter in your case from your log file).

Put your module at /path/to/perl/plugins/Collectd/Plugins/ matching it with the path that you specified ... (match the case of names of plugin and plugin pm file).

LoadPlugin perl
# ...
<Plugin perl>
  IncludeDir "/path/to/perl/plugins"
  BaseName "Collectd::Plugins"
  EnableDebugger ""
  LoadPlugin "FooBar"

  <Plugin FooBar>
    Foo "Bar"