From 496a18cdae66e13d5aa3f096d1b31e92d6ba5d28 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 19 May 2007 16:18:06 +0200 Subject: [PATCH] collectd-perl(5): Moved information about the `perl plugin' into an own manpage. --- src/Makefile.am | 5 +- src/collectd-exec.pod | 8 ++- src/collectd-perl.pod | 164 ++++++++++++++++++++++++++++++++++++++++++ src/collectd.pod | 134 +--------------------------------- 4 files changed, 178 insertions(+), 133 deletions(-) create mode 100644 src/collectd-perl.pod diff --git a/src/Makefile.am b/src/Makefile.am index 5303b520..6fd65622 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -549,7 +549,10 @@ collectd_LDADD += "-dlopen" wireless.la collectd_DEPENDENCIES += wireless.la endif -dist_man_MANS = collectd.1 collectd-nagios.1 collectd.conf.5 collectd-email.5 collectd-exec.5 collectd-unixsock.5 +dist_man_MANS = collectd.1 collectd-nagios.1 collectd.conf.5 \ + collectd-email.5 collectd-exec.5 collectd-perl.5 \ + collectd-unixsock.5 + #collectd_1_SOURCES = collectd.pod EXTRA_DIST = types.db diff --git a/src/collectd-exec.pod b/src/collectd-exec.pod index 111f2d00..cb6069cc 100644 --- a/src/collectd-exec.pod +++ b/src/collectd-exec.pod @@ -20,6 +20,9 @@ forked once and not again until it exits. If it exited, it will be forked again after at most I seconds. It is perfectly legal for the executable to run for a long time and continuously write values to C. +If you want/need better performance or more functionality you should take a +long look at the C, L. + =head1 DATA FORMAT The forked executable is expected to print values to C. The expected @@ -66,7 +69,10 @@ must have an UID that is non-zero. =head1 SEE ALSO -L, L, L, L +L, +L, +L, +L, L =head1 AUTHOR diff --git a/src/collectd-perl.pod b/src/collectd-perl.pod new file mode 100644 index 00000000..90a35daf --- /dev/null +++ b/src/collectd-perl.pod @@ -0,0 +1,164 @@ +=head1 NAME + +collectd-perl - Documentation of collectd's C + +=head1 SYNOPSIS + + # See collectd.conf(5) + LoadPlugin perl + # ... + + IncludeDir "/path/to/perl/plugins" + BaseName "Collectd::Plugin" + LoadPlugin "FooBar" + + +=head1 DESCRIPTION + +The C includes a Perl-interpreter in collectd and provides +Perl-equivalents of the plugin-functions. This makes it possible to write +plugins for collectd in Perl. This is a lot more performant than executing a +Perl-script every time you want to read a value with the C (see +L) and provides a lot more functionality, too. + +=head1 DATA TYPES + +There are two more complex types you need to know about: + +=over 4 + +=item Data-Set + +A data-set is a list of one or more data-sources. Each data-source defines a +name, type, min- and max-value and the data-set wraps them up into one +structure. The general layout looks like this: + + [{ + name => 'data_source_name', + type => DS_TYPE_COUNTER || DS_TYPE_GAUGE + min => value || undef, + max => value || undef + }, ...] + +=item Value-List + +A value-list is one structure which features an array of values and fields to +identify the values, i. e. time and host, plugin name and plugin-instance as +well as a type and type-instance. Since the "type" is not included in the +value-list but is passed as an extra argument, the general layout looks like +this: + + { + values => [123, 0.5], + time => time (), + host => 'localhost', + plugin => 'myplugin', + plugin_instance => '', + type_instance => '' + } + +=back + +=head1 METHODS + +The following functions provide the C-interface to Perl-modules. They are +automatically exported into the module's namespace. You don't need to C +any special Modules to access them. + +=over 4 + +=item B (I, I, I) + +Registers a callback-function or data-set. + +I can be one of: + +=over 4 + +=item TYPE_INIT + +=item TYPE_READ + +=item TYPE_WRITE + +=item TYPE_LOG + +=item TYPE_SHUTDOWN + +=item TYPE_DATASET + +=back + +I is the name of the callback-function or the type of the data-set, +depending on the value of I. (Please note that the type of the data-set +is the value passed as I here and has nothing to do with the I +argument which simply tells B what is being registered.) + +The last argument, I, is either a function- or an array-reference. If +I is B, then the I argument must be an +array-reference which points to an array of hashes. Each hash describes one +data-source. For the exact layout see B above. + +If the I argument is any of the other types (B, B, +...) then I is expected to be a function reference. These functions are +called in the various stages of the daemon and are passed the following +arguments: + +=over 4 + +=item TYPE_INIT + +=item TYPE_READ + +=item TYPE_SHUTDOWN + +No arguments are passed + +=item TYPE_WRITE + +The arguments passed are I, I, and I. I is a +string. For the layout of I and I see above. + +=item TYPE_LOG + +The arguments are I and I. The log level is small for +important messages and high for less important messages. The least important +level is B, the most important level is B. In between there +are (from least to most important): B, B, and +B. I is simply a string B a newline at the end. + +=back + +=item B (I, I) + +Removes a callback or data-set from collectd's internal list of +functionsE/ datasets. + +=item B (I, I) + +Submits a I of type I to the daemon. If the data-set I +is found (and the number of values matches the number of data-sources) then the +type, data-set and value-list is passed to all write-callbacks that are +registered with the daemon. + +=item B (I, I) + +Submits a I of level I to collectd's logging mechanism. +The message is passed to all log-callbacks that are registered with collectd. + +=back + +=head1 SEE ALSO + +L, +L, +L, +L + +=head1 AUTHOR + +The C has been written by Sebastian Harl EshEatEtokkee.orgE. + +This manpage has been written by Florian Forster EoctoEatEverplant.orgE. + +=cut diff --git a/src/collectd.pod b/src/collectd.pod index 5e4b3b24..9fe21280 100644 --- a/src/collectd.pod +++ b/src/collectd.pod @@ -82,143 +82,15 @@ Several loglevels let you suppress uninteresting messages. Please note that some plugins, that provide other means of communicating with the daemon, have manpages of their own to describe their functionality in more -detail. In particular those are L, L, -... - -=head1 SPECIAL PLUGINS - -=head2 perl - -The C includes a Perl-interpreter in collectd and provides -Perl-equivalents of the plugin-functions. This makes it possible to write -plugins in Perl. - -There are two more complex types you need to know about: - -=over 4 - -=item Data-Set - -A data-set is a list of one or more data-sources. Each data-source defines a -name, type, min- and max-value and the data-set wraps them up into one -structure. The general layout looks like this: - - [{ - name => 'data_source_name', - type => DS_TYPE_COUNTER || DS_TYPE_GAUGE - min => value || undef, - max => value || undef - }, ...] - -=item Value-List - -A value-list is one structure which features an array of values and fields to -identify the values, i. e. time and host, plugin name and plugin-instance as -well as a type and type-instance. Since the "type" is not included in the -value-list but is passed as an extra argument, the general layout looks like -this: - - { - values => [123, 0.5], - time => time (), - host => 'localhost', - plugin => 'myplugin', - plugin_instance => '', - type_instance => '' - } - -=back - -The following functions provide the C-interface to Perl-modules: - -=over 4 - -=item B (I, I, I) - -Registers a callback-function or data-set. - -I can be one of: - -=over 4 - -=item TYPE_INIT - -=item TYPE_READ - -=item TYPE_WRITE - -=item TYPE_LOG - -=item TYPE_SHUTDOWN - -=item TYPE_DATASET - -=back - -I is the name of the callback-function or the type of the data-set, -depending on the value of I. (Please note that the type of the data-set -is the value passed as I here and has nothing to do with the I -argument which simply tells B what is being registered.) - -The last argument, I, is either a function- or an array-reference. If -I is B, then the I argument must be an -array-reference which points to an array of hashes. Each hash describes one -data-source. For the exact layout see B above. - -If the I argument is any of the other types (B, B, -...) then I is expected to be a function reference. These functions are -called in the various stages of the daemon and are passed the following -arguments: - -=over 4 - -=item TYPE_INIT - -=item TYPE_READ - -=item TYPE_SHUTDOWN - -No arguments are passed - -=item TYPE_WRITE - -The arguments passed are I, I, and I. I is a -string. For the layout of I and I see above. - -=item TYPE_LOG - -The arguments are I and I. The log level is small for -important messages and high for less important messages. The least important -level is B, the most important level is B. In between there -are (from least to most important): B, B, and -B. I is simply a string B a newline at the end. - -=back - -=item B (I, I) - -Removes a callback or data-set from collectd's internal list of -functionsE/ datasets. - -=item B (I, I) - -Submits a I of type I to the daemon. If the data-set I -is found (and the number of values matches the number of data-sources) then the -type, data-set and value-list is passed to all write-callbacks that are -registered with the daemon. - -=item B (I, I) - -Submits a I of level I to collectd's logging mechanism. -The message is passed to all log-callbacks that are registered with collectd. - -=back +detail. In particular those are L, L, +L, and L =head1 SEE ALSO L, L, L, +L, L, L -- 2.30.2