[collectd] lua plugin

Schmurfy schmurfy at gmail.com
Sun Dec 5 18:12:19 CET 2010


Hi,
I added a form of alternative to the filters which should do the job for me.
I added a new hooks for plugins, they can register/unregister filter
callbacks, the way they work is dead simple:
The callback method receives a copy of the value_list structure and is free
to change whatever is inside (a safer version should prevent any changes to
the length of values and values_len, currently I did the check in the lua
plugin).

So what do you think of this solution ?
For me I can easily see it replace the curent filter system, here is a
concrete example:

function cb_filter(vl)
  if vl.plugin == "something"
    vl.plugin = "something_else"
  end

  return vl
end

this would rename everything from plugin "something" to come from the plugin
"something_else".
The code is pushed on my lua branch and is working.


For the callbacks dilemma I still have (you did not answer my last questions
on it ;) ), I have another option for you between yours and mine: Allow the
lua scripts to define ONE and only one callback for each type
(collectd_register_read would becomes collected_set_read_callback).
Unless proved wrong I am convinced that providing more than one callback for
each script is useless and makes the plugin code far more complex than it
could, ever more since the language we call the function in is well able to
handle a dispatcher easier than the C code if the user really wants it.

Julien Ammous.

On 5 December 2010 08:51, Florian Forster <octo at collectd.org> wrote:

> Hi Schmurfy,
>
> On Sun, Nov 28, 2010 at 04:30:10PM +0100, Schmurfy wrote:
> > $PKG_CONFIG --exists lua5.1 2>/dev/null
> > becomes
> > $PKG_CONFIG --exists "lua >= 5.1" 2>/dev/null
>
> I've fixed this in my "ja/lua" branch. The name used by pkg-config is
> not determined fully automatically, but you can specify it manually by
> using the following form:
>
>  $ ./configure [$OTHER_OPTIONS] LIBLUA_PKG_CONFIG_NAME="lua"
>
> Regards,
> —octo
> --
> Florian octo Forster
> Hacker in training
> GnuPG: 0x0C705A15
> http://octo.it/
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iQIcBAEBAgAGBQJM+0SQAAoJEMPSHpbi2MmgWYIQAJKgSkSCumWCaM/FaisPO6gZ
> 5uQKXd5+aoWUONyP4eh9LBZXY3ExTpSHJakCnVPpdrFDiKG7dUTwgIksVP1TCqbz
> gSzWJ4NDBRUoYG6ahaynvAAnewFjkfb3SSygeNVz1wZl2EEqN1SozEV2t0ahDBcO
> hoAduMF9XDbkPyBPLArWN5o10JPn/sG0kmUKZ6nMUWrLtBXiJkElF78QvfI7a7ZZ
> P1y1+K9hTXM5G5jWyvsP2aAgA3/ceyiEsrS9dLUZ20QeuiVeV/pTmoH4aI0rSRKJ
> MfbEIsnqJnZkqyLd63r79hKFwrl63G5j+T+eKAM4eCKiuNfBZLmcD8xiVQRNCmoc
> iFPBbfsN+e+bG4QnRG7DXW23Z1ZGiIkkNpTkU6rhjE/eH3Tiz8n2PsSwfo/cEvem
> wZOv8DAoZY4c7fYO3Er35vMnU0Am7RB+6cFc+JCJL8t2wjmLOjAUGKTKaTigaX2u
> PK6lp6PAFLBLpAeJwhZBRc0kNaTEtim24oFHcbpU9HBVca9u2YaRvoylSFJfhO49
> oDLv5llYLrq+s3hX440EOh7b5okj6lSKUWTrcuwOekE0vfwYHBLkasc9Cs44JYTy
> ok8aKk7MFEJr7FgCGxzFauP/NK0w6h9fJSHuI7r57GTGGT9oPCFus/vjBAvK/0Nu
> H9Z+Qz12Je5jxNFta8ud
> =LzTj
> -----END PGP SIGNATURE-----
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20101205/b232347b/attachment.htm>


More information about the collectd mailing list