[collectd] Collectd complex perl plugin question ...

Sebastien Cramatte scramatte at nixus.es
Wed Apr 4 14:53:18 CEST 2012


Thanks a lot for snippet.
I've still have an issue :(

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

In my plugin source I've got this line ...

plugin_register (TYPE_CONFIG, "mine", "mine_config");



Any Idea  of what occurs ?


Thank you for your help



El 04/04/12 13:50, "Fabien Wernli" <collectd at faxm0dem.org> escribió:

>Hi,
>
>On Wed, Apr 04, 2012 at 10:58:07AM +0200, Sebastian Harl wrote:
>> However, you could simple skip a couple of intervals in the read
>> callback function. I.e., use a global variable (for each instance of the
>> callback) to count down the number of intervals to be skipped. Make sure
>> to return 0 in case you skip the current interval. Then, manually set
>> the interval appropriately when dispatching values.
>
>Here's my two cents of what I have in all my perl plugins to handle the
>"Interval" config option:
>
>--
>package Collectd::Plugins::Mine;
>
>use Collectd qw( :all );
>
>my $interval = $interval_g;
>my $hostname = $hostname_g;
>my $last_ts = time();
>
>[...]
>
>sub my_config {
>  for my $child (@{$_[0] -> {children}}) {
>    if ($child -> {key} eq "Interval") {
>      $interval = $child -> {values} -> [0];
>[...]
>
>sub my_get {
>  my $ts = time;
>  return 1 if ($ts < $interval + $last_ts);
>[...]
>  plugin_dispatch_values(...);
>[...]
>  $last_ts = $ts;
>  return 1;
>}
>		 
>--
>
>Cheers
>
>
>_______________________________________________
>collectd mailing list
>collectd at verplant.org
>http://mailman.verplant.org/listinfo/collectd




More information about the collectd mailing list