X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcollectd-python.pod;h=16b26afad1af0a820059656fd0d1d10d89d39b35;hb=9eb3efd17e10c3bd59aa227d8d11fe60d6d4f303;hp=8564ae77e8c0210d9e47ac373743b54ee8c8ffff;hpb=4371ef7f98f6f51ea3df34d5e26e175d6b44a328;p=collectd.git diff --git a/src/collectd-python.pod b/src/collectd-python.pod index 8564ae77..16b26afa 100644 --- a/src/collectd-python.pod +++ b/src/collectd-python.pod @@ -37,7 +37,7 @@ for collectd in Python. This is a lot more efficient than executing a Python-script every time you want to read a value with the C (see L) and provides a lot more functionality, too. -The minimum required Python version is I<2.3>. +The minimum required Python version is I<2.6>. =head1 CONFIGURATION @@ -50,13 +50,15 @@ Loads the Python plugin I. =item B I The default encoding for Unicode objects you pass to collectd. If you omit this -option it will default to B on I and B on I. -This is hardcoded in Python and will ignore everything else, including your -locale. +option it will default to B on I. On I it will +always be B, as this function was removed, so this will be silently +ignored. +These defaults are hardcoded in Python and will ignore everything else, +including your locale. =item B I -Appends I to B. You won't be able to import any scripts you +Prepends I to B. You won't be able to import any scripts you wrote unless they are located in one of the directories in this list. Please note that it only has effect on plugins loaded after this option. You can use multiple B lines to add more than one directory. @@ -92,11 +94,12 @@ way of entering your commands. The daemonized collectd won't do that. =item * -B<2.> collectd will block I. Pressing I will usually cause +B<2.> Python will be handling I. Pressing I will usually cause collectd to shut down. This would be problematic in an interactive session, -therefore this signal will be blocked. You can still use it to interrupt -syscalls like sleep and pause but it won't generate a I -exception either. +therefore Python will be handling it in interactive sessions. This allows you +to use I to interrupt Python code without killing collectd. This also +means you can catch I exceptions which does not work during +normal operation. To quit collectd send I (press I at the beginning of a new line). @@ -555,7 +558,7 @@ receive blocks where your callback identifier matches BI. The callback will be called without arguments. -=item register_read(callback[, interval][, data][, name]) -> identifier +=item register_read(callback[, interval][, data][, name]) -> I This function takes an additional parameter: I. It specifies the time between calls to the callback function. @@ -609,6 +612,32 @@ I is either the string that was returned by the register function or a callback function. The identifier will be constructed in the same way as for the register functions. +=item B(I) -> I + +Returns the definition of a dataset specified by I. I is a list +of tuples, each representing one data source. Each tuple has 4 values: + +=over 4 + +=item name + +A string, the name of the data source. + +=item type + +A string that is equal to either of the variables B, +B, B or B. + +=item min + +A float or None, the minimum value. + +=item max + +A float or None, the maximum value. + +=back + =item B(I None Flush one or all plugins. I and the specified I are @@ -630,6 +659,8 @@ Any Python module will start similar to: A very simple read function might look like: + import random + def read(data=None): vl = collectd.Values(type='gauge') vl.plugin='python.spam' @@ -643,28 +674,12 @@ 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) + collectd.register_write(write) See the section L<"CLASSES"> above for a complete documentation of the data types used by the read, write and match functions. -=head1 NOTES - -=over 4 - -=item * - -Please feel free to send in new plugins to collectd's mailing list at -EcollectdEatEverplant.orgE for review and, possibly, -inclusion in the main distribution. In the latter case, we will take care of -keeping the plugin up to date and adapting it to new versions of collectd. - -Before submitting your plugin, please take a look at -L. - -=back - =head1 CAVEATS =over 4 @@ -723,7 +738,7 @@ Sven Trenkel EcollectdEatEsemidefinite.deE. This manpage has been written by Sven Trenkel EcollectdEatEsemidefinite.deE. It is based on the L manual page by -Florian Forster EoctoEatEverplant.orgE and +Florian Forster EoctoEatEcollectd.orgE and Sebastian Harl EshEatEtokkee.orgE. =cut