X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fcollectd-lua.pod;h=eccd71fb1f076acfde4c58bf6c0790702e0e83e4;hp=62dd850ede31f4060f13ad32c774b5e40229ad97;hb=48622c3d7c8c0d3ab07cda8a1947c33bfe31df73;hpb=ba420266281dac4ee5c1db44299db9594fb5b15a diff --git a/src/collectd-lua.pod b/src/collectd-lua.pod index 62dd850e..eccd71fb 100644 --- a/src/collectd-lua.pod +++ b/src/collectd-lua.pod @@ -12,7 +12,7 @@ =head1 NAME -collectd-lua - Documentation of Collectd's C +collectd-lua - Documentation of collectd's C =head1 SYNOPSIS @@ -26,9 +26,9 @@ collectd-lua - Documentation of Collectd's C =head1 DESCRIPTION -The C embeds a Lua interpreter into Collectd and provides an -interface to Collectd's plugin system. This makes it possible to write plugins -for Collectd in Lua. This is a lot more efficient than executing a +The C embeds a Lua interpreter into collectd and provides an +interface to collectd's plugin system. This makes it possible to write plugins +for collectd in Lua. This is a lot more efficient than executing a Lua script every time you want to read a value with the C (see L) and provides a lot more functionality, too. @@ -56,11 +56,11 @@ If B is not specified, this needs to be an absolute path. =head1 WRITING YOUR OWN PLUGINS -Writing your own plugins is quite simple. Collectd manages plugins by means of +Writing your own plugins is quite simple. collectd manages plugins by means of B which call the appropriate B registered by the plugins. Any plugin basically consists of the implementation of these callback functions and initializing code which registers the -functions with Collectd. See the section "EXAMPLES" below for a really basic +functions with collectd. See the section "EXAMPLES" below for a really basic example. The following types of B are implemented in the Lua plugin (all of them are optional): @@ -69,11 +69,11 @@ Lua plugin (all of them are optional): =item read functions These are used to collect the actual data. It is called once -per interval (see the B configuration option of Collectd). Usually -it will call B to dispatch the values to Collectd +per interval (see the B configuration option of collectd). Usually +it will call B to dispatch the values to collectd which will pass them on to all registered B. If this function -does not return 0 the plugin will be skipped for an increasing -amount of time until it returns normally again. +does not return 0, interval between its calls will grow until function returns +0 again. See the B configuration option of collectd. =item write functions @@ -86,14 +86,18 @@ once for every value that was dispatched by any plugin. The following functions are provided to Lua modules: +=over 4 + =item register_read(callback) +Function to register read callbacks. The callback will be called without arguments. If this callback function does not return 0 the next call will be delayed by an increasing interval. -=item register_write +=item register_write(callback) +Function to register write callbacks. The callback function will be called with one argument passed, which will be a table of values. If this callback function does not return 0 next call will be delayed by @@ -134,8 +138,8 @@ A very simple write function might look like: To register those functions with collectd: - collectd.register_read(read) - collectd.register_write(write) + collectd.register_read(read) -- pass function as variable + collectd.register_write("write") -- pass by global-scope function name =back @@ -148,12 +152,12 @@ L, =head1 AUTHOR The C has been written by -Julien Ammous Ej.ammousatEgmail.comE, +Julien Ammous Ej.ammousEatEgmail.comE, Florian Forster EoctoEatEcollectd.orgE and -Ruben Kerkhof ErubenatErubenkerkhof.com and +Ruben Kerkhof ErubenEatErubenkerkhof.comE. This manpage has been written by Ruben Kerkhof -ErubenatErubenkerkhof.com. +ErubenEatErubenkerkhof.comE. It is based on the L manual page by Florian Forster EoctoEatEcollectd.orgE and Sebastian Harl EshEatEtokkee.orgE.