collectd.conf(5): Moved information about ``special'' plugins from collectd(1) to...
[collectd.git] / src / collectd.pod
1 =head1 NAME
2
3 collectd - System statistics collection daemon
4
5 =head1 SYNOPSIS
6
7 collectd I<[options]>
8
9 =head1 DESCRIPTION
10
11 collectd is a daemon that receives system statistics and makes them available
12 in a number of ways. The main daemon itself doesn't have any real functionality
13 appart from loading, querying and submitting to plugins. For a description of
14 available plugins please see L</PLUGINS> below.
15
16 =head1 OPTIONS
17
18 Most of collectd's configuration is done using using a configfile. See
19 L<collectd.conf(5)> for an in-depth description of all options.
20
21 =over 4
22
23 =item B<-C> I<E<lt>config-fileE<gt>>
24
25 Specify an alternative config file. This is the place to go when you wish to
26 change B<collectd>'s behavior. The path may be relative to the current working
27 directory.
28
29 =item B<-P> I<E<lt>pid-fileE<gt>>
30
31 Specify an alternative pid file. This overwrites any settings in the config 
32 file. This is thought for init-scripts that require the PID-file in a certain
33 directory to work correctly. For everyday-usage use the B<PIDFile>
34 config-option.
35
36 =item B<-f>
37
38 Don't fork to the background. I<collectd> will also B<not> close standard file
39 descriptors, detach from the session nor write a pid file. This is mainly
40 thought for 'supervisioning' init replacements such as I<runit>.
41
42 =item B<-h>
43
44 Output usage information and exit.
45
46 =back
47
48 =head1 PLUGINS
49
50 As noted above, the real power of collectd lies within it's plugins. There are
51 two big groups of plugins, B<input> and B<output> plugins:
52
53 =over 4
54
55 =item
56
57 Input plugins are queried periodically. They somehow aquire the current value
58 of whatever they where designed to work with and submit these values back to
59 the daemon, i. e. they "dispatch" the values. As an example, the C<cpu plugin>
60 reads the current cpu-counters of time spent in the various modes (user,
61 system, nice, ...) and dispatches these counters to the daemon.
62
63 =item
64
65 Output plugins get the dispatched values from the daemon and does something
66 with them. Common applications are writing to RRD-files, CSV-files or sending
67 the data over a network link to a remote box.
68
69 =back
70
71 Of course not all plugins fit neatly into one of the two above categories. The
72 C<network plugin>, for example, is able to send (i.E<nbsp>e. "write") B<and>
73 receive (i.E<nbsp>e. "dispatch") values. Also, it opens a socket upon
74 initialization and dispatches the values when it receives them and isn't
75 triggered at the same time the input plugins are being read. You can think if
76 the network receive part as working asynchronous if it helps.
77
78 In addition to the above, there are "logging plugins". Right now those are the
79 C<logfile plugin> and the C<syslog plugin>. With these plugins collectd can
80 provide information about issues and significant situations to the user.
81 Several loglevels let you suppress uninteresting messages.
82
83 Please note that some plugins, that provide other means of communicating with
84 the daemon, have manpages of their own to describe their functionality in more
85 detail. In particular those are L<collectd-exec(5)>, L<collectd-unixsock(5)>,
86 ...
87
88 =head1 SPECIAL PLUGINS
89
90 =head2 email
91
92 This plugin collects data indirectly by providing a UNIX socket that external
93 programs can connect to. A simple line based protocol is used to communicate
94 with the plugin:
95
96 E-Mail type (e.g. "ham", "spam", "virus", ...) and size (bytes):
97
98   e:<type>:<size>
99
100 If C<size> is less than or equal to zero, C<size> is ignored.
101
102 Spam score:
103
104   s:<value>
105
106 Successful spam checks (e.g. "BAYES_99", "SUBJECT_DRUG_GAP_C", ...):
107
108   c:<type1>[,<type2>,...]
109
110 Each line is limited to 256 characters (including the newline character). 
111 Longer lines will be ignored.
112
113 =head2 perl
114
115 The C<perl plugin> includes a Perl-interpreter in collectd and provides
116 Perl-equivalents of the plugin-functions. This makes it possible to write
117 plugins in Perl.
118
119 There are two more complex types you need to know about:
120
121 =over 4
122
123 =item Data-Set
124
125 A data-set is a list of one or more data-sources. Each data-source defines a
126 name, type, min- and max-value and the data-set wraps them up into one
127 structure. The general layout looks like this:
128
129   [{
130     name => 'data_source_name',
131     type => DS_TYPE_COUNTER || DS_TYPE_GAUGE
132     min  => value || undef,
133     max  => value || undef
134   }, ...]
135
136 =item Value-List
137
138 A value-list is one structure which features an array of values and fields to
139 identify the values, i. e. time and host, plugin name and plugin-instance as
140 well as a type and type-instance. Since the "type" is not included in the
141 value-list but is passed as an extra argument, the general layout looks like
142 this:
143
144   {
145     values => [123, 0.5],
146     time   => time (),
147     host   => 'localhost',
148     plugin => 'myplugin',
149     plugin_instance => '',
150     type_instance   => ''
151   }
152
153 =back
154
155 The following functions provide the C-interface to Perl-modules:
156
157 =over 4
158
159 =item B<plugin_register> (I<type>, I<name>, I<data>)
160
161 Registers a callback-function or data-set.
162
163 I<type> can be one of:
164
165 =over 4
166
167 =item TYPE_INIT
168
169 =item TYPE_READ
170
171 =item TYPE_WRITE
172
173 =item TYPE_LOG
174
175 =item TYPE_SHUTDOWN
176
177 =item TYPE_DATASET
178
179 =back
180
181 I<name> is the name of the callback-function or the type of the data-set,
182 depending on the value of I<type>. (Please note that the type of the data-set
183 is the value passed as I<name> here and has nothing to do with the I<type>
184 argument which simply tells B<plugin_register> what is being registered.)
185
186 The last argument, I<data>, is either a function- or an array-reference. If
187 I<type> is B<TYPE_DATASET>, then the I<data> argument must be an
188 array-reference which points to an array of hashes. Each hash describes one
189 data-source. For the exact layout see B<Data-Set> above.
190
191 If the I<type> argument is any of the other types (B<TYPE_INIT>, B<TYPE_READ>,
192 ...) then I<data> is expected to be a function reference. These functions are
193 called in the various stages of the daemon and are passed the following
194 arguments:
195
196 =over 4
197
198 =item TYPE_INIT
199
200 =item TYPE_READ
201
202 =item TYPE_SHUTDOWN
203
204 No arguments are passed
205
206 =item TYPE_WRITE
207
208 The arguments passed are I<type>, I<data-set>, and I<value-list>. I<type> is a
209 string. For the layout of I<data-set> and I<value-list> see above.
210
211 =item TYPE_LOG
212
213 The arguments are I<log-level> and I<message>. The log level is small for
214 important messages and high for less important messages. The least important
215 level is B<LOG_DEBUG>, the most important level is B<LOG_ERR>. In between there
216 are (from least to most important): B<LOG_INFO>, B<LOG_NOTICE>, and
217 B<LOG_WARNING>. I<message> is simply a string B<without> a newline at the end.
218
219 =back
220
221 =item B<plugin_unregister> (I<type>, I<plugin>)
222
223 Removes a callback or data-set from collectd's internal list of
224 functionsE<nbsp>/ datasets.
225
226 =item B<plugin_dispatch_values> (I<type>, I<value-list>)
227
228 Submits a I<value-list> of type I<type> to the daemon. If the data-set I<type>
229 is found (and the number of values matches the number of data-sources) then the
230 type, data-set and value-list is passed to all write-callbacks that are
231 registered with the daemon.
232
233 =item B<plugin_log> (I<log-level>, I<message>)
234
235 Submits a I<message> of level I<log-level> to collectd's logging mechanism.
236 The message is passed to all log-callbacks that are registered with collectd.
237
238 =back
239
240 =head1 SEE ALSO
241
242 L<collectd.conf(5)>,
243 L<collectd-exec(5)>,
244 L<collectd-unixsock(5)>,
245 L<http://collectd.org/>
246
247 =head1 AUTHOR
248
249 Florian Forster E<lt>octo@verplant.orgE<gt>
250
251 =cut