1COLLECTD-EXEC(5)                   collectd                   COLLECTD-EXEC(5)
2
3
4

NAME

6       collectd-exec - Documentation of collectd's "exec plugin"
7

SYNOPSIS

9         # See collectd.conf(5)
10         LoadPlugin exec
11         # ...
12         <Plugin exec>
13           Exec "myuser:mygroup" "myprog"
14           Exec "otheruser" "/path/to/another/binary" "arg0" "arg1"
15           NotificationExec "user" "/usr/lib/collectd/exec/handle_notification"
16         </Plugin>
17

DESCRIPTION

19       The "exec plugin" forks of an executable either to receive values or to
20       dispatch notifications to the outside world. The syntax of the
21       configuration is explained in collectd.conf(5) but summarized in the
22       above synopsis.
23
24       If you want/need better performance or more functionality you should
25       take a long look at the "perl plugin", collectd-perl(5).
26

EXECUTABLE TYPES

28       There are currently two types of executables that can be executed by
29       the "exec plugin":
30
31       "Exec"
32           These programs are forked and values that it writes to "STDOUT" are
33           read back.  The executable is forked in a fashion similar to init:
34           It is forked once and not again until it exits. If it exited, it
35           will be forked again after at most Interval seconds. It is
36           perfectly legal for the executable to run for a long time and
37           continuously write values to "STDOUT".
38
39           See "EXEC DATA FORMAT" below for a description of the output format
40           expected from these programs.
41
42           Warning: If the executable only writes one value and then exits I
43           will be executed every Interval seconds. If Interval is short (the
44           default is 10 seconds) this may result in serious system load.
45
46       "NotificationExec"
47           The program is forked once for each notification that is handled by
48           the daemon.  The notification is passed to the program on "STDIN"
49           in a fashion similar to HTTP-headers. In contrast to programs
50           specified with "Exec" the execution of this program is not
51           serialized, so that several instances of this program may run at
52           once if multiple notifications are received.
53
54           See "NOTIFICATION DATA FORMAT" below for a description of the data
55           passed to these programs.
56

EXEC DATA FORMAT

58       The forked executable is expected to print values to "STDOUT". The
59       expected format is as follows:
60
61       Comments
62           Each line beginning with a "#" (hash mark) is ignored.
63
64       PUTVAL Identifier [OptionList] Valuelist
65           Submits one or more values (identified by Identifier, see below) to
66           the daemon which will dispatch it to all it's write-plugins.
67
68           An Identifier is of the form "host/plugin-instance/type-instance"
69           with both instance-parts being optional. If they're omitted the
70           hyphen must be omitted, too. plugin and each instance-part may be
71           chosen freely as long as the tuple (plugin, plugin instance, type
72           instance) uniquely identifies the plugin within collectd. type
73           identifies the type and number of values (i. e. data-set) passed to
74           collectd. A large list of predefined data-sets is available in the
75           types.db file. See types.db(5) for a description of the format of
76           this file.
77
78           The OptionList is an optional list of Options, where each option is
79           a key-value-pair. A list of currently understood options can be
80           found below, all other options will be ignored. Values that contain
81           spaces must be quoted with double quotes.
82
83           Valuelist is a colon-separated list of the time and the values,
84           each either an integer if the data-source is a counter, or a double
85           if the data-source is of type "gauge". You can submit an undefined
86           gauge-value by using U. When submitting U to a counter the behavior
87           is undefined. The time is given as epoch (i. e. standard UNIX
88           time).
89
90           You can mix options and values, but the order is important: Options
91           only effect following values, so specifying an option as last field
92           is allowed, but useless. Also, an option applies to all following
93           values, so you don't need to re-set an option over and over again.
94
95           The currently defined Options are:
96
97           interval=seconds
98               Gives the interval in which the data identified by Identifier
99               is being collected.
100
101           Please note that this is the same format as used in the unixsock
102           plugin, see collectd-unixsock(5). There's also a bit more
103           information on identifiers in case you're confused.
104
105           Since examples usually let one understand a lot better, here are
106           some:
107
108             leeloo/cpu-0/cpu-idle N:2299366
109             alice/interface/if_octets-eth0 interval=10 1180647081:421465:479194
110
111           Since this action was the only one supported with older versions of
112           the "exec plugin" all lines were treated as if they were prefixed
113           with PUTVAL. This is still the case to maintain backwards
114           compatibility but deprecated.
115
116       PUTNOTIF [OptionList] message=Message
117           Submits a notification to the daemon which will then dispatch it to
118           all plugins which have registered for receiving notifications.
119
120           The PUTNOTIF if followed by a list of options which further
121           describe the notification. The message option is special in that it
122           will consume the rest of the line as its value. The message,
123           severity, and time options are mandatory.
124
125           Valid options are:
126
127           message=Message (REQUIRED)
128               Sets the message of the notification. This is the message that
129               will be made accessible to the user, so it should contain some
130               useful information. As with all options: If the message
131               includes spaces, it must be quoted with double quotes. This
132               option is mandatory.
133
134           severity=failure|warning|okay (REQUIRED)
135               Sets the severity of the notification. This option is
136               mandatory.
137
138           time=Time (REQUIRED)
139               Sets the time of the notification. The time is given as
140               "epoch", i. e. as seconds since January 1st, 1970, 00:00:00.
141               This option is mandatory.
142
143           host=Hostname
144           plugin=Plugin
145           plugin_instance=Plugin-Instance
146           type=Type
147           type_instance=Type-Instance
148               These "associative" options establish a relation between this
149               notification and collected performance data. This connection is
150               purely informal, i. e. the daemon itself doesn't do anything
151               with this information. However, websites or GUIs may use this
152               information to place notifications near the affected graph or
153               table. All the options are optional, but plugin_instance
154               without plugin or type_instance without type doesn't make much
155               sense and should be avoided.
156
157       Please note that this is the same format as used in the unixsock
158       plugin, see collectd-unixsock(5).
159
160       When collectd exits it sends a SIGTERM to all still running child-
161       processes upon which they have to quit.
162

NOTIFICATION DATA FORMAT

164       The notification executables receive values rather than providing them.
165       In fact, after the program is started "STDOUT" is connected to
166       "/dev/null".
167
168       The data is passed to the executables over "STDIN" in a format very
169       similar to HTTP: At first there is a "header" with one line per field.
170       Every line consists of a field name, ended by a colon, and the
171       associated value until end-of-line.  The "header" is ended by two
172       newlines immediately following another, i. e. an empty line. The rest,
173       basically the "body", is the message of the notification.
174
175       The following is an example notification passed to a program:
176
177         Severity: FAILURE
178         Time: 1200928930
179         Host: myhost.mydomain.org
180         \n
181         This is a test notification to demonstrate the format
182
183       The following header files are currently used. Please note, however,
184       that you should ignore unknown header files to be as forward-compatible
185       as possible.
186
187       Severity
188           Severity of the notification. May either be FAILURE, WARNING, or
189           OKAY.
190
191       Time
192           The time in epoch, i. e. as seconds since 1970-01-01 00:00:00 UTC.
193
194       Host
195       Plugin
196       PluginInstance
197       Type
198       TypeInstance
199           Identification of the performance data this notification is
200           associated with.  All of these fields are optional because
201           notifications do not need to be associated with a certain value.
202

ENVIRONMENT

204       The following environment variables are set by the plugin before
205       calling exec:
206
207       COLLECTD_INTERVAL
208           Value of the global interval setting.
209
210       COLLECTD_HOSTNAME
211           Hostname used by collectd to dispatch local values.
212

USING NAGIOS PLUGINS

214       Though the interface is far from perfect, there are tons of plugins for
215       Nagios.  You can use these plugins with collectd by using a simple
216       transition layer, "exec-nagios.px", which is shipped with the collectd
217       distribution in the "contrib/" directory. It is a simple Perl script
218       that comes with embedded documentation. To see it, run the following
219       command:
220
221         perldoc exec-nagios.px
222
223       This script expects a configuration file, "exec-nagios.conf". You can
224       find an example in the "contrib/" directory, too.
225
226       Even a simple mechanism to submit "performance data" to collectd is
227       implemented. If you need a more sophisticated setup, please rewrite the
228       plugin to make use of collectd's more powerful interface.
229

CAVEATS

231       ยท   The user, the binary is executed as, may not have root privileges,
232           i. e.  must have an UID that is non-zero. This is for your own
233           good.
234

SEE ALSO

236       collectd(1), collectd.conf(5), collectd-perl(5), collectd-unixsock(5),
237       fork(2), exec(3)
238

AUTHOR

240       Florian Forster <octo@verplant.org>
241
242
243
2444.9.5                             2011-03-26                  COLLECTD-EXEC(5)
Impressum