+=encoding UTF-8
+
=head1 NAME
collectd-perl - Documentation of collectd's C<perl plugin>
# ...
<Plugin perl>
IncludeDir "/path/to/perl/plugins"
- BaseName "Collectd::Plugin"
+ BaseName "Collectd::Plugins"
EnableDebugger ""
LoadPlugin "FooBar"
=item B<BaseName> I<Name>
Prepends I<Name>B<::> to all plugin names loaded after this option. This is
-provided for convenience to keep plugin names short.
+provided for convenience to keep plugin names short. All Perl-based plugins
+provided with the I<collectd> distributions reside in the C<Collectd::Plugins>
+namespace.
=item E<lt>B<Plugin> I<Name>E<gt> block
=item Config-Item
-A config-item is one structure which keeps the informations provided in the
+A config-item is one structure which keeps the information provided in the
configuration file. The array of children keeps one entry for each
configuration option. Each such entry is another config-item structure, which
may nest further if nested blocks are used.
{
values => [123, 0.5],
time => time (),
- interval => $interval_g,
+ interval => plugin_get_interval (),
host => $hostname_g,
plugin => 'myplugin',
type => 'myplugin',
type, data-set and value-list is passed to all write-callbacks that are
registered with the daemon.
-B<Note>: Prior to version 4.4 of collectd, the data-set type used to be passed
-as the first argument to B<plugin_register>. This syntax is still supported
-for backwards compatibility but has been deprecated and will be removed in
-some future version of collectd.
-
=item B<plugin_write> ([B<plugins> => I<...>][, B<datasets> => I<...>],
B<valuelists> => I<...>)
the B<plugins> and B<identifiers> arguments may either be a string or a
reference to an array of strings.
-=item B<plugin_flush_one> (I<timeout>, I<plugin>)
-
-This is identical to using "plugin_flush (timeout =E<gt> I<timeout>, plugins
-=E<gt> I<plugin>".
-
-B<Note>: Starting with version 4.5 of collectd, B<plugin_flush_one> has been
-deprecated and will be removed in some future version of collectd. Use
-B<plugin_flush> instead.
-
-=item B<plugin_flush_all> (I<timeout>)
-
-This is identical to using "plugin_flush (timeout =E<gt> I<timeout>)".
-
-B<Note>: Starting with version 4.5 of collectd, B<plugin_flush_all> has been
-deprecated and will be removed in some future version of collectd. Use
-B<plugin_flush> instead.
-
=item B<plugin_dispatch_notification> (I<notification>)
Submits a I<notification> to the daemon which will then pass it to all
Wrappers around B<plugin_log>, using B<LOG_ERR>, B<LOG_WARNING>,
B<LOG_NOTICE>, B<LOG_INFO> and B<LOG_DEBUG> respectively as I<log-level>.
+=item B<plugin_get_interval> ()
+
+Returns the interval of the current plugin as a floating point number in
+seconds. This value depends on the interval configured within the
+C<LoadPlugin perl> block or the global interval (see L<collectd.conf(5)> for
+details).
+
=back
The following function provides the filter chain C-interface to Perl-modules.
This variable keeps the interval in seconds in which the read functions are
queried (see the B<Interval> configuration option).
+B<Note:> This variable should no longer be used in favor of
+C<plugin_get_interval()> (see above). This function takes any plugin-specific
+interval settings into account (see the C<Interval> option of C<LoadPlugin> in
+L<collectd.conf(5)> for details).
+
=back
Any changes to these variables will be globally visible in collectd.
sub foobar_read
{
- my $vl = { plugin => 'foobar' };
+ my $vl = { plugin => 'foobar', type => 'gauge' };
$vl->{'values'} = [ rand(42) ];
- plugin_dispatch_values ('gauge', $vl);
+ plugin_dispatch_values ($vl);
return 1;
}
=item
-Please feel free to send in new plugins to collectd's mailinglist at
+Please feel free to send in new plugins to collectd's mailing list at
E<lt>collectdE<nbsp>atE<nbsp>verplant.orgE<gt> 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.