Merge branch 'pull/collectd-4'
[collectd.git] / src / collectd.pod
index 0e1adc5..6d29804 100644 (file)
@@ -16,7 +16,7 @@ settings. The following features may be available:
 
 =item
 
-Apache server stats (I<apache>)
+Apache and lighttpd server statistics (I<apache>)
 
 =item
 
@@ -40,14 +40,30 @@ Disk and partition usage/throughput (I<disk>)
 
 =item
 
+DNS traffic (I<dns>)
+
+=item
+
+Email usage (I<email>)
+
+=item
+
 Harddisk temperatures (I<hddtemp>)
 
 =item
 
+Irq (I<irq>)
+
+=item
+
 System load averages (I<load>)
 
 =item
 
+Motherboard monitor (I<mbmon>)
+
+=item
+
 Memory usage (I<memory>)
 
 =item
@@ -60,6 +76,10 @@ NFS utilization (I<nfs>, Linux only)
 
 =item
 
+Embedded Perl interpreter (I<perl>)
+
+=item
+
 Network latency (I<ping>)
 
 =item
@@ -158,10 +178,10 @@ values.
 
 =head2 apache
 
-This module connects to an Apache webserver and expects the output produced by
-B<mod_status.c>. If requires B<libcurl> to set up the HTTP connection and issue
-the request(s). The following is a sample config for the Apache webserver. The
-use of C<ExtendedStatus on> is mandatory.
+This module connects to an Apache or lighttpd webserver and expects the output
+produced by B<mod_status.c>. If requires B<libcurl> to set up the HTTP
+connection and issue the request(s). The following is a sample config for the
+Apache webserver. Under Apache, the use of C<ExtendedStatus on> is mandatory.
 
   ExtendedStatus on
   <IfModule mod_status.c>
@@ -180,6 +200,62 @@ not exist make sure B<cpufreqd> (L<http://cpufreqd.sourceforge.net/>) or a
 similar tool is installed and an "cpu governor" (that's kernel module) is
 loaded.
 
+=head2 email
+
+This plugin collects data indirectly by providing a UNIX socket that external
+programs can connect to. A simple line based protocol is used to communicate
+with the plugin:
+
+E-Mail type (e.g. "ham", "spam", "virus", ...) and size (bytes):
+
+  e:<type>:<size>
+
+If C<size> is less than or equal to zero, C<size> is ignored.
+
+Spam score:
+
+  s:<value>
+
+Successful spam checks (e.g. "BAYES_99", "SUBJECT_DRUG_GAP_C", ...):
+
+  c:<type1>[,<type2>,...]
+
+Each line is limited to 256 characters (including the newline character). 
+Longer lines will be ignored.
+
+=head2 exec
+
+The C<exec> plugin forks of an executable and reads back values that it writes
+to C<STDOUT>. The executable is forked kind of as L<init> does: It is forked
+once and not again until it exits. If it exited, it will be forked again after
+at most I<Interval> seconds. It is perfectly legal for the executable to run
+for a long time and continuously write values to C<STDOUT>.
+
+The forked executable is expected to print values to C<STDOUT>. The expected
+format is as follows:
+
+=over 4
+
+=item
+
+Each line beginning with a C<#> (hash mark) is ignored.
+
+=item
+
+Any other line must be of the form C<I<type>,I<type-instance>,I<value>>, where
+I<type> is either B<counter> or B<gauge>, I<type-instance> may not contain
+C<,> (comma), C</> (slash) and C<\0> (null byte) and I<value> is either an
+integer (if I<type> is B<counter>) or a floating-point number (if I<type> is
+B<gauge>).
+
+=back
+
+The values are always considered to be "fresh", i.E<nbsp>e. the time is set to
+"now".
+
+When collectd exits it sends a B<SIGTERM> to all still running
+child-processes upon which they have to quit.
+
 =head2 mysql
 
 Requires B<mysqlclient> to be installed. It connects to the database when
@@ -194,6 +270,133 @@ C<Qcache_*> are put in F<mysql_qcache.rrd> and values of C<Threads_*> are put
 in F<mysql_threads.rrd>. Please refer to the B<MySQL reference manual>,
 I<5.2.4. Server Status Variables> for an explanation of these values.
 
+=head2 perl
+
+The C<perl plugin> 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<plugin_register> (I<type>, I<name>, I<data>)
+
+Registers a callback-function or data-set.
+
+I<type> 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<name> is the name of the callback-function or the type of the data-set,
+depending on the value of I<type>. (Please note that the type of the data-set
+is the value passed as I<name> here and has nothing to do with the I<type>
+argument which simply tells B<plugin_register> what is being registered.)
+
+The last argument, I<data>, is either a function- or an array-reference. If
+I<type> is B<TYPE_DATASET>, then the I<data> 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<Data-Set> above.
+
+If the I<type> argument is any of the other types (B<TYPE_INIT>, B<TYPE_READ>,
+...) then I<data> 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<type>, I<data-set>, and I<value-list>. I<type> is a
+string. For the layout of I<data-set> and I<value-list> see above.
+
+=item TYPE_LOG
+
+The arguments are I<log-level> and I<message>. The log level is small for
+important messages and high for less important messages. The least important
+level is B<LOG_DEBUG>, the most important level is B<LOG_ERR>. In between there
+are (from least to most important): B<LOG_INFO>, B<LOG_NOTICE>, and
+B<LOG_WARNING>. I<message> is simply a string B<without> a newline at the end.
+
+=back
+
+=item B<plugin_unregister> (I<type>, I<plugin>)
+
+Removes a callback or data-set from collectd's internal list of
+functionsE<nbsp>/ datasets.
+
+=item B<plugin_dispatch_values> (I<type>, I<value-list>)
+
+Submits a I<value-list> of type I<type> to the daemon. If the data-set I<type>
+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<plugin_log> (I<log-level>, I<message>)
+
+Submits a I<message> of level I<log-level> to collectd's logging mechanism.
+The message is passed to all log-callbacks that are registered with collectd.
+
+=back
+
 =head2 sensors
 
 The B<sensors> module uses lm_sensors to retrieve sensor-values. This means
@@ -204,6 +407,20 @@ L<sensors.conf(5)> for details.
 The B<lm_sensors> homepage can be found at
 L<http://secure.netroedge.com/~lm78/>.
 
+=head2 mbmon
+
+The B<mbmon> module uses mbmon to retrieve temperature, voltage, etc.
+
+collectd connects to B<localhost> (127.0.0.1), port B<411/tcp>.
+The B<Host> and B<Port> options can be used to change these
+default values. See L<collectd.conf(5)> for details. C<mbmon> has to be
+running to work correctly. If C<mbmon> is not running timeouts may appear
+which may interfere with other statistics..
+
+C<mbmon> must be run with the -r option ("print TAG and Value format");
+Debian's /etc/init.d/mbmon script already does this, other people
+will need to ensure that this is the case.
+
 =head2 hddtemp
 
 To get values from B<hddtemp> collectd connects to B<localhost> (127.0.0.1),
@@ -326,10 +543,22 @@ The DS'es depend on the module creating the RRD files:
   DS:wcount:COUNTER:HEARTBEAT:0:U
   DS:wbytes:COUNTER:HEARTBEAT:0:U
 
+=item E-Mail count (F<email/email-I<E<lt>typeE<gt>>.rrd>)
+
+  DS:count:GAUGE:HEARTBEAT:0:U
+
+=item E-Mail size (F<email/email_size-I<E<lt>typeE<gt>>.rrd>)
+
+  DS:size:GAUGE:HEARTBEAT:0:U
+
 =item HDD Temperature (F<hddtemp-I<E<lt>majorE<gt>>-I<E<lt>minorE<gt>>.rrd>)
 
   DS:value:GAUGE:HEARTBEAT:U:U
 
+=item Irq (F<irq-I<E<lt>irqnumberE<gt>>.rrd>)
+
+  DS:value:COUNTER:HEARTBEAT:0:65535
+
 =item System load (F<load.rrd>)
 
   DS:shortterm:GAUGE:HEARTBEAT:0:100
@@ -421,15 +650,31 @@ The DS'es depend on the module creating the RRD files:
   DS:paging:GAUGE:HEARTBEAT:0:65535
   DS:blocked:GAUGE:HEARTBEAT:0:65535
 
-=item lm_sensors (F<sensors-I<E<lt>chipE<gt>>-I<E<lt>featureE<gt>>.rrd>)
+=item lm_sensors fanspeed sensor (F<sensors-I<E<lt>instE<gt>>.rrd> or F<lm_sensors-I<E<lt>chipE<gt>>/fanspeed-I<E<lt>instE<gt>>.rrd>)
+
+  DS:value:GAUGE:HEARTBEAT:U:U
+
+=item lm_sensors temperature sensor (F<sensors-I<E<lt>instE<gt>>.rrd> or F<lm_sensors-I<E<lt>chipE<gt>>/temperature-I<E<lt>instE<gt>>.rrd>)
 
   DS:value:GAUGE:HEARTBEAT:U:U
 
+=item lm_sensors voltage sensor (F<sensors-I<E<lt>instE<gt>>.rrd> or F<lm_sensors-I<E<lt>chipE<gt>>/voltage-I<E<lt>instE<gt>>.rrd>)
+
+  DS:voltage:GAUGE:HEARTBEAT:U:U
+
 =item Serial port traffic (F<serial-I<E<lt>numE<gt>>.rrd>)
 
   DS:incoming:COUNTER:HEARTBEAT:0:U
   DS:outgoing:COUNTER:HEARTBEAT:0:U
 
+=item Spam score (F<email/spam_score.rrd>)
+
+  DS:score:GAUGE:HEARTBEAT:0:U
+
+=item Spam checks (F<email/spam_check-I<E<lt>typeE<gt>>.rrd>)
+
+  DS:hits:GAUGE:HEARTBEAT:0:U
+
 =item Swap usage (F<swap.rrd>)
 
   DS:used:GAUGE:HEARTBEAT:0:1099511627776
@@ -508,6 +753,7 @@ The DS'es depend on the module creating the RRD files:
 =head1 SEE ALSO
 
 L<collectd.conf(5)>, L<rrdtool(1)>, L<sensors(1)>, L<hddtemp(8)>,
+L<mbmon(1)>,
 L<kstat(3KSTAT)>
 
 =head1 AUTHOR