.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "COLLECTD-EXEC 5" .TH COLLECTD-EXEC 5 "2020-07-20" "5.11.0.94.g41b1e33" "collectd" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" collectd\-exec \- Documentation of collectd's "exec plugin" .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 8 \& # See collectd.conf(5) \& LoadPlugin exec \& # ... \& \& Exec "myuser:mygroup" "myprog" \& Exec "otheruser" "/path/to/another/binary" "arg0" "arg1" \& NotificationExec "user" "/usr/lib/collectd/exec/handle_notification" \& .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The \f(CW\*(C`exec plugin\*(C'\fR forks off an executable either to receive values or to dispatch notifications to the outside world. The syntax of the configuration is explained in \fBcollectd.conf\fR\|(5) but summarized in the above synopsis. .PP If you want/need better performance or more functionality you should take a long look at the \f(CW\*(C`perl plugin\*(C'\fR, \fBcollectd\-perl\fR\|(5). .SH "EXECUTABLE TYPES" .IX Header "EXECUTABLE TYPES" There are currently two types of executables that can be executed by the \&\f(CW\*(C`exec plugin\*(C'\fR: .ie n .IP """Exec""" 4 .el .IP "\f(CWExec\fR" 4 .IX Item "Exec" These programs are forked and values that it writes to \f(CW\*(C`STDOUT\*(C'\fR are read back. The executable is forked in a fashion similar to init: It is forked once and not again until it exits. If it exited, it will be forked again after at most \&\fIInterval\fR seconds. It is perfectly legal for the executable to run for a long time and continuously write values to \f(CW\*(C`STDOUT\*(C'\fR. .Sp See \*(L"\s-1EXEC DATA FORMAT\*(R"\s0 below for a description of the output format expected from these programs. .Sp \&\fBWarning:\fR If the executable only writes one value and then exits it will be executed every \fIInterval\fR seconds. If \fIInterval\fR is short (the default is 10 seconds) this may result in serious system load. .ie n .IP """NotificationExec""" 4 .el .IP "\f(CWNotificationExec\fR" 4 .IX Item "NotificationExec" The program is forked once for each notification that is handled by the daemon. The notification is passed to the program on \f(CW\*(C`STDIN\*(C'\fR in a fashion similar to HTTP-headers. In contrast to programs specified with \f(CW\*(C`Exec\*(C'\fR the execution of this program is not serialized, so that several instances of this program may run at once if multiple notifications are received. .Sp See \*(L"\s-1NOTIFICATION DATA FORMAT\*(R"\s0 below for a description of the data passed to these programs. .SH "EXEC DATA FORMAT" .IX Header "EXEC DATA FORMAT" The forked executable is expected to print values to \f(CW\*(C`STDOUT\*(C'\fR. The expected format is as follows: .IP "Comments" 4 .IX Item "Comments" Each line beginning with a \f(CW\*(C`#\*(C'\fR (hash mark) is ignored. .IP "\fB\s-1PUTVAL\s0\fR \fIIdentifier\fR [\fIOptionList\fR] \fIValuelist\fR" 4 .IX Item "PUTVAL Identifier [OptionList] Valuelist" Submits one or more values (identified by \fIIdentifier\fR, see below) to the daemon which will dispatch it to all its write-plugins. .Sp An \fIIdentifier\fR is of the form \&\f(CW\*(C`\f(CIhost\f(CW\f(CB/\f(CW\f(CIplugin\f(CW\f(CB\-\f(CW\f(CIinstance\f(CW\f(CB/\f(CW\f(CItype\f(CW\f(CB\-\f(CW\f(CIinstance\f(CW\*(C'\fR with both \&\fIinstance\fR\-parts being optional. If they're omitted the hyphen must be omitted, too. \fIplugin\fR and each \fIinstance\fR\-part may be chosen freely as long as the tuple (plugin, plugin instance, type instance) uniquely identifies the plugin within collectd. \fItype\fR identifies the type and number of values (i.\ e. data-set) passed to collectd. A large list of predefined data-sets is available in the \fBtypes.db\fR file. See \fBtypes.db\fR\|(5) for a description of the format of this file. .Sp The \fIOptionList\fR is an optional list of \fIOptions\fR, where each option is a key-value-pair. A list of currently understood options can be found below, all other options will be ignored. Values that contain spaces must be quoted with double quotes. .Sp \&\fIValuelist\fR is a colon-separated list of the time and the values, each either an integer if the data-source is a counter, or a double if the data-source is of type \*(L"gauge\*(R". You can submit an undefined gauge-value by using \fBU\fR. When submitting \fBU\fR to a counter the behavior is undefined. The time is given as epoch (i.\ e. standard \s-1UNIX\s0 time) or \fBN\fR to use the current time. .Sp You can mix options and values, but the order is important: Options only effect following values, so specifying an option as last field is allowed, but useless. Also, an option applies to \fBall\fR following values, so you don't need to re-set an option over and over again. .Sp The currently defined \fBOptions\fR are: .RS 4 .IP "\fBinterval=\fR\fIseconds\fR" 4 .IX Item "interval=seconds" Gives the interval in which the data identified by \fIIdentifier\fR is being collected. .IP "meta:\fBkey\fR=\fIvalue\fR" 4 .IX Item "meta:key=value" Add meta data with the key \fBkey\fR and the value \fIvalue\fR. .RE .RS 4 .Sp Please note that this is the same format as used in the \fBunixsock plugin\fR, see \&\fBcollectd\-unixsock\fR\|(5). There's also a bit more information on identifiers in case you're confused. .Sp Since examples usually let one understand a lot better, here are some: .Sp .Vb 2 \& PUTVAL leeloo/cpu\-0/cpu\-idle N:2299366 \& PUTVAL alice/interface/if_octets\-eth0 interval=10 1180647081:421465:479194 .Ve .RE .IP "\fB\s-1PUTNOTIF\s0\fR [\fIOptionList\fR] \fBmessage=\fR\fIMessage\fR" 4 .IX Item "PUTNOTIF [OptionList] message=Message" Submits a notification to the daemon which will then dispatch it to all plugins which have registered for receiving notifications. .Sp The \fB\s-1PUTNOTIF\s0\fR if followed by a list of options which further describe the notification. The \fBmessage\fR option is special in that it will consume the rest of the line as its value. The \fBmessage\fR, \fBseverity\fR, and \fBtime\fR options are mandatory. .Sp Valid options are: .RS 4 .IP "\fBmessage=\fR\fIMessage\fR (\fB\s-1REQUIRED\s0\fR)" 4 .IX Item "message=Message (REQUIRED)" Sets the message of the notification. This is the message that will be made accessible to the user, so it should contain some useful information. As with all options: If the message includes spaces, it must be quoted with double quotes. This option is mandatory. .IP "\fBseverity=failure\fR|\fBwarning\fR|\fBokay\fR (\fB\s-1REQUIRED\s0\fR)" 4 .IX Item "severity=failure|warning|okay (REQUIRED)" Sets the severity of the notification. This option is mandatory. .IP "\fBtime=\fR\fITime\fR (\fB\s-1REQUIRED\s0\fR)" 4 .IX Item "time=Time (REQUIRED)" Sets the time of the notification. The time is given as \*(L"epoch\*(R", i.\ e. as seconds since January 1st, 1970, 00:00:00. This option is mandatory. .IP "\fBhost=\fR\fIHostname\fR" 4 .IX Item "host=Hostname" .PD 0 .IP "\fBplugin=\fR\fIPlugin\fR" 4 .IX Item "plugin=Plugin" .IP "\fBplugin_instance=\fR\fIPlugin-Instance\fR" 4 .IX Item "plugin_instance=Plugin-Instance" .IP "\fBtype=\fR\fIType\fR" 4 .IX Item "type=Type" .IP "\fBtype_instance=\fR\fIType-Instance\fR" 4 .IX Item "type_instance=Type-Instance" .PD These \*(L"associative\*(R" options establish a relation between this notification and collected performance data. This connection is purely informal, i.\ e. the daemon itself doesn't do anything with this information. However, websites or GUIs may use this information to place notifications near the affected graph or table. All the options are optional, but \fBplugin_instance\fR without \fBplugin\fR or \fBtype_instance\fR without \fBtype\fR doesn't make much sense and should be avoided. .IP "\fBtype:key=\fR\fIvalue\fR" 4 .IX Item "type:key=value" Sets user defined meta information. The \fBtype\fR key is a single character defining the type of the meta information. .Sp The current supported types are: .RS 4 .IP "\fBs\fR A string passed as-is." 8 .IX Item "s A string passed as-is." .RE .RS 4 .RE .RE .RS 4 .RE .PP Please note that this is the same format as used in the \fBunixsock plugin\fR, see \&\fBcollectd\-unixsock\fR\|(5). .PP When collectd exits it sends a \fB\s-1SIGTERM\s0\fR to all still running child-processes upon which they have to quit. .SH "NOTIFICATION DATA FORMAT" .IX Header "NOTIFICATION DATA FORMAT" The notification executables receive values rather than providing them. In fact, after the program is started \f(CW\*(C`STDOUT\*(C'\fR is connected to \f(CW\*(C`/dev/null\*(C'\fR. .PP The data is passed to the executables over \f(CW\*(C`STDIN\*(C'\fR in a format very similar to \&\s-1HTTP:\s0 At first there is a \*(L"header\*(R" with one line per field. Every line consists of a field name, ended by a colon, and the associated value until end-of-line. The \*(L"header\*(R" is ended by two newlines immediately following another, i.e. an empty line. The rest, basically the \*(L"body\*(R", is the message of the notification. .PP The following is an example notification passed to a program: .PP .Vb 5 \& Severity: FAILURE \& Time: 1200928930.515 \& Host: myhost.mydomain.org \& \en \& This is a test notification to demonstrate the format .Ve .PP The following header files are currently used. Please note, however, that you should ignore unknown header files to be as forward-compatible as possible. .IP "\fBSeverity\fR" 4 .IX Item "Severity" Severity of the notification. May either be \fB\s-1FAILURE\s0\fR, \fB\s-1WARNING\s0\fR, or \fB\s-1OKAY\s0\fR. .IP "\fBTime\fR" 4 .IX Item "Time" The time in epoch, i.e. as seconds since 1970\-01\-01 00:00:00 \s-1UTC.\s0 The value currently has millisecond precision (i.e. three decimal places), but scripts should accept arbitrary numbers of decimal places, including no decimal places. .IP "\fBHost\fR" 4 .IX Item "Host" .PD 0 .IP "\fBPlugin\fR" 4 .IX Item "Plugin" .IP "\fBPluginInstance\fR" 4 .IX Item "PluginInstance" .IP "\fBType\fR" 4 .IX Item "Type" .IP "\fBTypeInstance\fR" 4 .IX Item "TypeInstance" .PD Identification of the performance data this notification is associated with. All of these fields are optional because notifications do not \fBneed\fR to be associated with a certain value. .SH "ENVIRONMENT" .IX Header "ENVIRONMENT" The following environment variables are set by the plugin before calling \&\fIexec\fR: .IP "\s-1COLLECTD_INTERVAL\s0" 4 .IX Item "COLLECTD_INTERVAL" Value of the global interval setting. .IP "\s-1COLLECTD_HOSTNAME\s0" 4 .IX Item "COLLECTD_HOSTNAME" Hostname used by \fIcollectd\fR to dispatch local values. .SH "USING NAGIOS PLUGINS" .IX Header "USING NAGIOS PLUGINS" Though the interface is far from perfect, there are tons of plugins for Nagios. You can use these plugins with collectd by using a simple transition layer, \&\f(CW\*(C`exec\-nagios.px\*(C'\fR, which is shipped with the collectd distribution in the \&\f(CW\*(C`contrib/\*(C'\fR directory. It is a simple Perl script that comes with embedded documentation. To see it, run the following command: .PP .Vb 1 \& perldoc exec\-nagios.px .Ve .PP This script expects a configuration file, \f(CW\*(C`exec\-nagios.conf\*(C'\fR. You can find an example in the \f(CW\*(C`contrib/\*(C'\fR directory, too. .PP Even a simple mechanism to submit \*(L"performance data\*(R" to collectd is implemented. If you need a more sophisticated setup, please rewrite the plugin to make use of collectd's more powerful interface. .SH "CAVEATS" .IX Header "CAVEATS" .IP "\(bu" 4 The user, the binary is executed as, may not have root privileges, i.\ e. must have an \s-1UID\s0 that is non-zero. This is for your own good. .IP "\(bu" 4 Early versions of the plugin did not use a command but treated all lines as if they were arguments to the \fI\s-1PUTVAL\s0\fR command. When the \fI\s-1PUTNOTIF\s0\fR command was implemented, this behavior was kept for lines which start with an unknown command for backwards compatibility. This compatibility code has been removed in \fIcollectd\ 5\fR. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBcollectd\fR\|(1), \&\fBcollectd.conf\fR\|(5), \&\fBcollectd\-perl\fR\|(5), \&\fBcollectd\-unixsock\fR\|(5), \&\fBfork\fR\|(2), \fBexec\fR\|(3) .SH "AUTHOR" .IX Header "AUTHOR" Florian Forster