Merge branch 'collectd-4.0'
[collectd.git] / src / collectd-exec.pod
1 =head1 NAME
2
3 collectd-exec - Documentation of collectd's C<exec plugin>
4
5 =head1 SYNOPSIS
6
7   # See collectd.conf(5)
8   LoadPlugin exec
9   # ...
10   <Plugin exec>
11     Exec myuser myprog
12     Exec otheruser /path/to/another/binary
13   </Plugin>
14
15 =head1 DESCRIPTION
16
17 The C<exec plugin> forks of an executable and reads back values that it writes
18 to C<STDOUT>. The executable is forked in a fashion similar to L<init>: It is
19 forked once and not again until it exits. If it exited, it will be forked again
20 after at most I<Interval> seconds. It is perfectly legal for the executable to
21 run for a long time and continuously write values to C<STDOUT>.
22
23 If you want/need better performance or more functionality you should take a
24 long look at the C<perl plugin>, L<collectd-perl(5)>.
25
26 =head1 DATA FORMAT
27
28 The forked executable is expected to print values to C<STDOUT>. The expected
29 format is as follows:
30
31 =over 4
32
33 =item
34
35 Each line beginning with a C<#> (hash mark) is ignored.
36
37 =item
38
39 Other lines must consist of an I<Identifier>, an optional I<Option-List> and a
40 I<Value-List>, separated by a spaces. A description of these two parts follows:
41
42 An I<Identifier> is of the form
43 C<I<host>B</>I<plugin>B<->I<instance>B</>I<type>B<->I<instance>> with both
44 I<instance>-parts being optional. If they're omitted the hyphen must be
45 omitted, too.
46
47 The I<OptionList> is an optional list of I<Options>, where each option if a
48 key-value-pair. A list of currently understood options can be found below, all
49 other options will be ignored.
50
51 I<Valuelist> is a colon-seperated list of the time and the values, each either
52 an integer if the data-source is a counter, of a double if the data-source if
53 of type "gauge". You can submit an undefined gauge-value by using B<U>. When
54 submitting B<U> to a counter the behavior is undefined. The time is given as
55 epoch (i.E<nbsp>e. standard UNIX time).
56
57 You can mix options and values, but the order is important: Options only
58 effect following values, so specifying an option as last field is allowed, but
59 useless. Also, an option applies to B<all> following values, so you don't need
60 to re-set an option over and over again.
61
62 The currently defined B<Options> are:
63
64 =over 4
65
66 =item B<interval=>I<seconds>
67
68 Gives the interval in which the data identified by I<Identifier> is being
69 collected.
70
71 =back
72
73 Please note that this is the same format as used in the B<unixsock plugin>, see
74 L<collectd-unixsock(5)>. There's also a bit more information on identifiers in
75 case you're confused.
76
77 Since examples usually let one understand a lot better, here are some:
78
79   leeloo/cpu-0/cpu-idle N:2299366
80   alice/interface/if_octets-eth0 interval=10 1180647081:421465:479194
81
82 =back
83
84 When collectd exits it sends a B<SIGTERM> to all still running
85 child-processes upon which they have to quit.
86
87 =head1 CAVEATS
88
89 =over 4
90
91 =item
92
93 If the executable only writes one value and then exits I will be executed every
94 I<Interval> seconds. If I<Interval> is short (the default is 10 seconds) this
95 may result in serious system load.
96
97 =item
98
99 The user, the binary is executed as, may not have root privileges, i.E<nbsp>e.
100 must have an UID that is non-zero.
101
102 =back
103
104 =head1 SEE ALSO
105
106 L<collectd(1)>,
107 L<collectd.conf(5)>,
108 L<collectd-perl(5)>,
109 L<collectd-unixsock(5)>,
110 L<fork(2)>, L<exec(3)>
111
112 =head1 AUTHOR
113
114 Florian Forster E<lt>octo@verplant.orgE<gt>
115
116 =cut