[collectd] perl plugin: Added a plugin to embed a Perl interpreter into collectd.

Sebastian Harl sh<span style="display: none;">.trailing-username</span>(a)<span style="display: none;">leading-domain.</span>tokkee.org
Tue Apr 10 10:47:33 CEST 2007


Hi,

On Tue, Apr 10, 2007 at 10:12:20AM +0200, Florian Forster wrote:
> On Mon, Apr 09, 2007 at 06:26:48PM +0200, Sebastian Harl wrote:
> - Lines like the following are pretty long. I'd drop the `Collectd::'-
>   prefix.
>   `Collectd::plugin_register (Collectd::TYPE_DATASET, 'test_type', ...)'

I agree (even though, I personally still prefer the long version ;-). I will
make it possible (if not already) to import the module's symbols.

> - `LoadPlugin "foo"' will try to load ``Collectd::plugin::foo''. While I
>   think this naming scheme is good (though I'd use `Plugin' with a
>   capital `P') I wouldn't force it on the user. If
>   ``MyCompany::Collectd::GreatPlugin'' fit's the local scheme better, it
>   should be possible to use that, too.

I was thinking about that as well. This is going to be a patch no longer than
10-20 lines. You can expect it some time tonight :-)

> - A config-option to set or prepend to the search paths (`@INC') would
>   be most usefull.

Ack.

> - `die' and `warn' should do something usefull, e. g. disable the plugin
>   and call `plugin_log', respectively.

As discussed on IRC, warn() will be quite easy to overwrite. die() is probably
going to be more complex as I need to find out the calling module.

As you already suggested, the following actions will replace the default
behavior:

 - warn: log a message using plugin_log()
 - die: disable the module

It might also make sense to make this behavior configurable (e.g. "DieAction
DisableModule|Die"). Any comments?

There are probably some other functions that need to be overwritten. Right
now, exit() comes to my mind. Any others you can think of?

> - The function `plugin_log' should be exported to Perl.

A patch will be available tonight as well.

> > TODO:
> >   write documentation
> 
> I'll write something up. It'd be good if you could look over that and
> possibly correct it, though.

Sure.

> >   add checks for perl to configure
> 
> I'll take care of that.
 
> All that being said: Thank you very much for the plugin :) It took me 15
> minutes to get a working Perl-plugin - without any documentation other
> than your commit message :)

Great :-)

Cheers,
Sebastian

-- 
Sebastian "tokkee" Harl
GnuPG-ID: 0x8501C7FC
http://tokkee.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/20070410/c6e0ffa4/attachment.pgp


More information about the collectd mailing list